[
https://issues.apache.org/jira/browse/AMQ-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stephen Vincent updated AMQ-4072:
---------------------------------
Comment: was deleted
(was: Here is a test pgm:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
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.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
public class CorrelId
{
public static void main( String[] args ) throws Exception
{
ActiveMQConnectionFactory conFac;
Connection connection;
Session session;
Destination destination;
MessageProducer producer;
DefaultHttpClient 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 DefaultHttpClient();
HttpGet httpget = new
HttpGet("http://localhost:8161/demo/message/myqueue?readTimeout=1000&type=queue&clientId=test"
);
HttpResponse response = httpClient.execute(httpget);
Header[] headers = response.getAllHeaders();
for ( int i = 0; i < headers.length; i++ )
System.out.println( headers[i++] );
// Examine the response status
System.out.println(response.getStatusLine());
// Get hold of the response entity
HttpEntity entity = response.getEntity();
if ( entity != null )
{
InputStream instream = entity.getContent();
try
{
BufferedReader reader = new BufferedReader(
new InputStreamReader(instream));
// do something useful with the response
System.out.println(reader.readLine());
}
catch ( IOException ex )
{
// In case of an IOException the connection will be released
// back to the connection manager automatically
throw ex;
} catch (RuntimeException ex) {
// In case of an unexpected exception you may want to abort
// the HTTP request in order to shut down the underlying
// connection and release it back to the connection manager.
httpget.abort();
throw ex;
}
finally
{
// Closing the input stream will trigger connection release
instream.close();
}
// When HttpClient instance is no longer needed,
// shut down the connection manager to ensure
// immediate deallocation of all system resources
httpClient.getConnectionManager().shutdown();
}
}
catch( Exception e )
{
System.out.println( e.getMessage() );
}
}
}
)
> RESTful HTTP interface responses do not contain a correlation ID header
> -----------------------------------------------------------------------
>
> Key: AMQ-4072
> URL: https://issues.apache.org/jira/browse/AMQ-4072
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker
> Affects Versions: 5.6.0
> Environment: RESTful HTTP client
> Reporter: Stephen Vincent
> Priority: Critical
> Fix For: 5.7.0
>
> Attachments: CorrelId.java
>
>
> When using a RESTful HTTP client to GET a message that has a correlation ID,
> the correlation ID is not sent as a header in the response from the broker.
> This inhibits my RESTful HTTP client from performing request-response.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira