use of com.netflix.governator.guice.lazy.LazySingleton in project microservices by pwillhan.
the class RabbitMqMiddlewareModule method channelProvider.
@LazySingleton
@Provides
public ChannelProvider channelProvider(final ServiceConfiguration configuration) throws URISyntaxException, IOException, NoSuchAlgorithmException, KeyManagementException {
final RabbitMqConfiguration rabbitMqConfiguration = configuration.getRabbitMqConfiguration();
final Host host = new Host(rabbitMqConfiguration.getRmqUri());
return new SimpleChannelProvider(rabbitMqConfiguration.getUsername(), rabbitMqConfiguration.getPassword(), rabbitMqConfiguration.getVhost(), new Address[] { new Address(host.getUri().getHost()) });
}
Aggregations