activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve.V." <>
Subject Re: No correlation ID in HTTP header when using RESTful interface
Date Mon, 24 Sep 2012 02:50:01 GMT
Maybe I am missing something, but the test mentioned seems to get and compare
the body of the message with the correlation ID string that was also sent as
the body/content of the message.  In other words, I believe that test
receives the correlation ID by way of the body because that is the content
of the message that is put on the queue.  So, while I believe that test does
set the correlation ID of the message that is sent; I don't believe that
test proves that the response contains a correlation ID as a header.  The
following is a trimmed-down version of the test mentioned in Dejan's last
response.  I don't know how to modify that to print-out the headers.  If
someone does, I will modify the test below and enter a JIRA.
import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.eclipse.jetty.client.ContentExchange;
import org.eclipse.jetty.client.HttpClient;

 public class Corid
  public static void main( String[] args ) throws Exception
    ActiveMQConnectionFactory conFac;
    Connection          connection;
    Session             session;
    Destination         destination;
    MessageProducer     producer;
    HttpClient          httpClient;

        conFac = new ActiveMQConnectionFactory(
                                "tcp://localhost:61616" );
        connection = conFac.createConnection();
        session = connection.createSession( false,
                                            Session.AUTO_ACKNOWLEDGE );
        destination = session.createQueue( "myqueue" );
        producer = session.createProducer( destination );
        producer.setDeliveryMode( DeliveryMode.NON_PERSISTENT );
        String text = "Hello";
        TextMessage message = session.createTextMessage( text );
        String correlId = "Resty 123";
        message.setStringProperty( "correlationId", correlId );
        message.setJMSCorrelationID( correlId );
        producer.send( message );

        httpClient = new HttpClient();
        ContentExchange contentExchange = new ContentExchange();
        httpClient.send( contentExchange );
        System.out.println( "status: " + contentExchange.getResponseStatus()
        System.out.println( "response content: " +
contentExchange.getResponseContent() );
    catch( Exception e )
        System.out.println( e.getMessage() );

Stephen Vincent
View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message