activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve.V." <stephen.vinc...@sas.com>
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;

    try
    {
        conFac = new ActiveMQConnectionFactory(
                                "tcp://localhost:61616" );
        connection = conFac.createConnection();
        connection.start();
        session = connection.createSession( false,
                                            Session.AUTO_ACKNOWLEDGE );
        destination = session.createQueue( "myqueue" );
        producer = session.createProducer( destination );
        producer.setDeliveryMode( DeliveryMode.NON_PERSISTENT );
        producer.setTimeToLive(60000);
        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();
        httpClient.start();
        ContentExchange contentExchange = new ContentExchange();
        httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
        contentExchange.setURL(
"http://localhost:8161/demo/message/myqueue?readTimeout=1000&type=queue&clientId=test"
);
        httpClient.send( contentExchange );
        contentExchange.waitForDone();
        System.out.println( "status: " + contentExchange.getResponseStatus()
);
        System.out.println( "response content: " +
contentExchange.getResponseContent() );
        producer.close();
        session.close();
        connection.close();
    }
    catch( Exception e )
    {
        System.out.println( e.getMessage() );
    }
  }
}
-----------------------



-----
Stephen Vincent
--
View this message in context: http://activemq.2283324.n4.nabble.com/No-correlation-ID-in-HTTP-header-when-using-RESTful-interface-tp4656327p4656839.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message