er::Transport::Redis;
use Mojo::Base 'Minion::Notifier::Transport';
use Mojo::Redis2;
use Mojo::JSON;
has redis => sub { die 'A Mojo::Redis2 instance is required' };
has channel => 'minion_notifie
jo::JSON::decode_json $payload;
$self->emit(notified => @$args);
});
$self->redis->subscribe([$channel], sub {});
}
sub send {
my ($self, $id, $message) = @_;
my $payload = Mojo::JSON::en
code_json([$id, $message]);
Mojo::IOLoop->delay(sub{
$self->redis->publish($self->channel, $payload, shift->begin);
})->wait;
}
1;
my $self = shift;
$self->ua->websocket($self->url => sub {
my ($ua, $tx) = @_;
$tx->on(json => sub {
my ($tx, $data) = @_;
$self->emit(notified => @$data);
});
});
}
sub
send {
my ($self, $id, $message) = @_;
$self->ua->websocket($self->url => sub {
my ($ua, $tx) = @_;
$tx->send({json => [$id, $message]}); #TODO finish after send?
});
}
1;
:Notifier::Transport::Pg;
use Mojo::Base 'Minion::Notifier::Transport';
use Mojo::Pg;
use Mojo::JSON;
has pg => sub { die 'A Mojo::Pg instance is required' };
has channel => 'minion_notifier_job';
o::JSON::decode_json $payload;
$self->emit(notified => @$args);
});
}
sub send {
my ($self, $id, $message) = @_;
$self->pg->pubsub->notify(
$self->channel,
Mojo::JSON::encode_json([