-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable RMQ messaging for Publisher in production #162
Conversation
iainrb
commented
Dec 11, 2017
- Add PublisherFactory and PublisherWithMessaging classes, with tests
- The PublisherFactory returns a PublisherWithMessaging if RabbitMQ is enabled; Publisher otherwise
- RabbitMQ classes are imported at runtime using 'require'; allows running without RabbitMQ prerequisites installed
- PublisherWithMessaging replaces PublisherMQTest
- Shared RMQ test methods moved into TestRabbitMQ.pm
- TODO Add parameters to explicitly enable/disable RabbitMQ instead of relying on the NPG_RMQ_CONFIG environment variable
Additions in commit 50ba359
|
|
||
has 'exchange' => | ||
(is => 'ro', | ||
isa => 'Maybe[Str]', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use predicates instread of MayBe
see wtsi-npg/npg_irods#89
my $exchange_key = 'exchange'; | ||
my $prefix_key = 'routing_key_prefix'; | ||
my @rmq_keys = ($exchange_key, $prefix_key); | ||
foreach my $key (@rmq_keys) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be no need to check initargs this because Publisher
uses MooseX::StrictConstructor
. If you're accepting arguments to the factory method that need validating, it may be better to configure the factory to do the work and just allow some minimal positional parameters for the factory method itself.
use Moose; | ||
use strict; | ||
use warnings; | ||
use Moose::Role; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why changed to a role? These methods will now appear in the public API of anything that consumes them - do they need to?