Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Hi, I am trying to create two consumers on a single session using the xms provider, but facing this error :
{"CWSMQ0101E: Synchronous method call not permitted when a session is being used asynchronously: CreateConsumer.\r\nThe XMS specification does not permit the use of a session for synchronous methods when asynchronous message delivery is running.\r\nCreate a separate session if you wish to use both synchronous methods and asynchronous delivery simultaneously."}But, when I am trying to do the same thing by directly using the ibm.xms library, I am able to do so.
So, is this a limitation of the nms xms provider ? If that is the case, why does the exception states that XMS specification does not permit it.
Below are the codes for two different cases :
Using NMS provider :
ConnectionFactory factory = new ConnectionFactory(new Uri("***?wmq.channelname=*&queuemanagername=**"));
Apache.NMS.IConnection conn = factory.CreateConnection("userid", "pwd");
conn.Start();
ISession se = conn.CreateSession();
IDestination qu = se.GetQueue("***");
IMessageConsumer consumer = se.CreateConsumer(qu);
IMessageConsumer consumer2 = se.CreateConsumer(qu);
This is giving me error.
Using IBM.XMS directly :
IConnection connection = factory.CreateConnection();
connection.Start();
ISession se = connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge);
IDestination des = se.CreateQueue("***");
IDestination des2 = se.CreateQueue("***");
IMessageConsumer consu = se.CreateConsumer(des);
IMessageProducer prod = se.CreateProducer(des);
IMessageConsumer consu2 = se.CreateConsumer(des);
This is working fine.
Please help.