[
https://issues.apache.org/jira/browse/QPIDJMS-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15870373#comment-15870373
]
Robbie Gemmell commented on QPIDJMS-264:
----------------------------------------
I'd like to see the wireshark trace, even if just to get a better overall idea
of exactly what happens when. This issue would also perhaps explain/be the same
as the other JIRA Keith raised, QPIDJMS-239, which we havent been able to
reproduce either despite a lot of trying. Unfortunately it isnt obvious from
the code how this could happen. Something subtle must be involved that we arent
seeing, and the capture would be another source of data to try and help see
what it is.
> Incoming messages are dispatched out of order
> ----------------------------------------------
>
> Key: QPIDJMS-264
> URL: https://issues.apache.org/jira/browse/QPIDJMS-264
> Project: Qpid JMS
> Issue Type: Bug
> Components: qpid-jms-client
> Affects Versions: 0.20.0
> Reporter: Alex Rudyy
> Priority: Critical
> Attachments: out-of-order.log.tgz
>
>
> Both current trunk version and version 0.20.0 of JMS Client can dispatch
> incoming messages out of order into client application. I did not test
> earlier versions. The messages are received in the right order but Client
> dispatches them occasionally out of order.
> I used the following code to reproduce the issue with trunk version of Java
> Broker.
> {code}
> public static void main(String[] args) throws Exception
> {
> for (int i=0;i<100;i++)
> {
> execute(i);
> }
> }
> public static void execute(int iteration) throws Exception
> {
> System.out.println("Iteration " + iteration);
> Connection managingConnection = createConnection();
> Session session =
> managingConnection.createSession(Session.SESSION_TRANSACTED);
> Connection consumingConnection = createConnection();
> Session consumerSession = consumingConnection.createSession(true,
> Session.SESSION_TRANSACTED);
> Queue queue = createTestQueue(session, "Q3-test");
> session.commit();
> MessageConsumer consumer = consumerSession.createConsumer(queue);
> Connection producingConnection = createConnection();
> Session producerSession = producingConnection.createSession(true,
> Session.SESSION_TRANSACTED);
> MessageProducer producer = producerSession.createProducer(queue);
> producer.send(producerSession.createTextMessage("msg1"));
> producer.send(producerSession.createTextMessage("msg2"));
> producer.send(producerSession.createTextMessage("msg3"));
> producer.send(producerSession.createTextMessage("msg4"));
> producerSession.commit();
> consumingConnection.start();
> TextMessage tm = (TextMessage) consumer.receive();
> System.out.println(">" + tm.getText());
> if (!"msg1".equals(tm.getText()))
> {
> throw new RuntimeException("Unexpected");
> }
> deleteQueue(session, "Q3-test");
> consumingConnection.close();
> producingConnection.close();
> managingConnection.close();
> }
> private static Queue createTestQueue(Session session, String queueName)
> throws JMSException
> {
> MessageProducer producer =
> session.createProducer(session.createQueue("$management"));
> MapMessage createMessage = session.createMapMessage();
> createMessage.setStringProperty("type", "org.apache.qpid.Queue");
> createMessage.setStringProperty("operation", "CREATE");
> createMessage.setString("name", queueName);
> createMessage.setString("object-path", "org.apache.qpid.Queue");
> producer.send(createMessage);
> if (session.getTransacted())
> {
> session.commit();
> }
> return session.createQueue(queueName);
> }
> private static void deleteQueue(Session session, String queueName)throws
> JMSException
> {
> MessageProducer producer =
> session.createProducer(session.createQueue("$management"));
> MapMessage createMessage = session.createMapMessage();
> createMessage.setStringProperty("type", "org.apache.qpid.Queue");
> createMessage.setStringProperty("operation", "DELETE");
> createMessage.setStringProperty("index", "object-path");
> createMessage.setStringProperty("key", queueName);
> producer.send(createMessage);
> if (session.getTransacted())
> {
> session.commit();
> }
> }
> private static Connection createConnection() throws JMSException,
> NamingException {
> Properties properties = new Properties();
> properties.put("java.naming.factory.initial",
> "org.apache.qpid.jms.jndi.JmsInitialContextFactory");
> properties.put("connectionfactory.myFactoryLookup",
> "amqp://localhost:5672");
> Context context = new InitialContext(properties);
> try
> {
> ConnectionFactory factory = (ConnectionFactory)
> context.lookup("myFactoryLookup");
> return factory.createConnection("admin", "admin");
> }
> finally
> {
> context.close();
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]