These are chat archives for christopherread/Obvs

21st
Nov 2016
Simon McConnell
@Unthred
Nov 21 2016 11:56
@inter8ection Can I bother you again? So kinda following your earlier advice I have used Daishi.AMQP for my round robin type message processing and I am using obvs to broadcast to all my webservers. However I seem to have a couple of problems I am hoping you can work out where I am being an idiot ;-P
Christopher Read
@christopherread
Nov 21 2016 11:59
@Unthred yeah sure, just pop your questions on here and I will take a look
Simon McConnell
@Unthred
Nov 21 2016 11:59
1) I seem to have much more connections than I thought I would. Just running 1 consumer I seem to have connections in multiples of 4....according to the RabbitMQ admin page. 2) the connections never seem to drop. 3) After its up and running each message seems to have 8 connections
So I create them so
ServiceBus = Obvs.ServiceBus.Configure()
.WithRabbitMQEndpoints<IMasterBaseMessage>()
.Named(typeof(MasterBroadcaster).Name)
.ConnectToBroker("amqp://localhost")
.SerializedAsJson()
.AsClient()
.UsingLog4Net()
.Create();
Christopher Read
@christopherread
Nov 21 2016 12:01
1) yes this is certainly possible as in earlier transport implementations I opened one connection per type of message (command/event/request/response) and for subscribe and send = 4 x 2 = 8, per service. This was to ensure one connection didnt block another one. I later optimised connection use on the Obvs.ActiveMQ transport, so just need to do the same on RabbitMQ. Feel free to chuck an issue in.
Simon McConnell
@Unthred
Nov 21 2016 12:02
and the other end so
_serviceBus = Obvs.ServiceBus.Configure()
.WithRabbitMQEndpoints<IMasterBaseMessage>()
.Named(typeof(MasterBroadcaster).Name)
.ConnectToBroker("amqp://localhost")
.SerializedAsJson()
.AsServer()
.UsingLog4Net()
.Create();
        _serviceBus.Commands.OfType<RefreshPageCommand>().Subscribe(RefreshPage);
        _serviceBus.Commands.OfType<ResolveEposErrorCommand>().Subscribe(ResolveEposError);
        _serviceBus.Commands.OfType<GetSurveyorCreationProgressCommand>().Subscribe(GetSurveyorCreationProgress);
        _serviceBus.Commands.OfType<ReloadGlobalSettingsCommand>().Subscribe(ReloadGlobalSettings);
Oh thats marvellous will log an issue now
Christopher Read
@christopherread
Nov 21 2016 12:04
2) yes, I need to ensure proper disposal. again this is done on ActiveMQ, I just haven't optimised RabbitMQ yet
Simon McConnell
@Unthred
Nov 21 2016 12:06
Great I can stop banging my head against it, thinking I was misunderstanding something. I don't mean to be pushy but do you have any idea when you might be able to do this? As its kinda stopping me from putting it into QA for testing
Christopher Read
@christopherread
Nov 21 2016 12:07
@Unthred I'll try to take a look at this later today or at least by end of week. I also accept PR's ;)
number of connections isnt bad in itself, unless your broker is struggling
Simon McConnell
@Unthred
Nov 21 2016 12:08
That would be amazing! Hmmmmm interesting...... I am not sure I understand it well enough yet to delve into a PR
Christopher Read
@christopherread
Nov 21 2016 12:10
public MessageSource(IConnectionFactory connectionFactory, IEnumerable<IMessageDeserializer<TMessage>> deserializers, string exchange, string routingKeyPrefix)
        {
            _exchange = exchange;
            _deserializers = deserializers.ToDictionary(d => d.GetTypeName());

            _connection = connectionFactory.CreateConnection();
            _channel = _connection.CreateModel();
            _channel.ExchangeDeclare(_exchange, ExchangeType.Topic);
            _routingKey = string.Format("{0}.*", routingKeyPrefix);
        }
@Unthred That's the offending bit of code to modify, it creates a connection per messagesource & publisher, in the ctor. Whereas in the ActiveMQ ones I pass in a connection from further up. Don't worry, not hard to fix, shouldnt take me long.
Simon McConnell
@Unthred
Nov 21 2016 12:12
Fantastic!! thank you!