Hi Dan,
I've found out that amqp-js opens two channels when it is connected to
RabbitMQ.
Firebug shows it:
--- Begin ConnectionOpenOk ---
knownHosts = ;
---- End ConnectionOpenOk ----
Ready
--- Begin ChannelOpen ---
outOfBand = ;
---- End ChannelOpen ----
--- Begin ChannelOpen ---
outOfBand = ;
---- End ChannelOpen ----
... and "rabbitmqctl list_channels number" shows that the channels 1
and 2 are open per each browser window.
Is it expected behaviour?
According to RabbitMQ documentation (
http://www.rabbitmq.com/api-guide.html#channel-threads
)
-----------------------------------------------
" Channel thread-safety.
In general, Channel instances should not be used by more than one
thread simultaneously: application code should maintain a clear notion
of thread ownership for Channel instances. If more than one thread
needs to access a particular Channel instance, the application should
enforce mutual exclusion itself, for example by synchronising on the
Channel.
Symptoms of incorrect serialisation of Channel operations include, but
are not limited to, IllegalStateExceptions with the message "cannot
execute more than one synchronous AMQP command at a time", and
UnexpectedFrameErrors."
-----------------------------------------------
BTW, I've run into the issue of losing messages which are published by
several clients simultaneously.
I suppose that it is due the bottleneck in one channel.
So, I suggest a new scheme. It would be great if we could specify this
number by setting underlying property in MQ.configure().
For example,
MQ.configure({
channel: 51,
...})
As for me, I would set the number of the channel as a random positive
integer within the range 1 - 65535.
Thanks.