/queues |
secure the POST operation to secure queue creation |
/queues/{queue-name} |
secure the GET HEAD operation to getting information about the queue. |
/queues/{queue-name}/create/\* |
secure this URL pattern for producing messages. |
/queues/{queue-name}/pull-consumers/\* |
secure this URL pattern for pushing messages. |
/queues/{queue-name}/push-consumers/\* |
secure the POST operation to secure topic creation |
/topics |
secure the POST operation to secure topic creation |
/topics/{topic-name} |
secure the GET HEAD operation to getting information about the topic. |
/topics/{topic-name}/create/\* |
secure this URL pattern for producing messages. |
/topics/{topic-name}/pull-subscriptions/\* |
secure this URL pattern for pulling messages. |
/topics/{topic-name}/push-subscriptions/\* |
secure this URL pattern for pushing messages. |
## Mixing JMS and REST
The ActiveMQ REST interface supports mixing JMS and REST producers and
consumers. You can send an ObjectMessage through a JMS Producer, and
have a REST client consume it. You can have a REST client POST a message
to a topic and have a JMS Consumer receive it. Some simple
transformations are supported if you have the correct RESTEasy providers
installed.
### JMS Producers - REST Consumers
If you have a JMS producer, the ActiveMQ REST interface only supports
ObjectMessage type. If the JMS producer is aware that there may be REST
consumers, it should set a JMS property to specify what Content-Type the
Java object should be translated into by REST clients. The ActiveMQ REST
server will use RESTEasy content handlers (MessageBodyReader/Writers) to
transform the Java object to the type desired. Here's an example of a
JMS producer setting the content type of the message.
ObjectMessage message = session.createObjectMessage();
message.setStringProperty(org.apache.activemq.rest.HttpHeaderProperty.CONTENT_TYPE, "application/xml");
If the JMS producer does not set the content-type, then this information
must be obtained from the REST consumer. If it is a pull consumer, then
the REST client should send an Accept header with the desired media
types it wants to convert the Java object into. If the REST client is a
push registration, then the type attribute of the link element of the
push registration should be set to the desired type.
### REST Producers - JMS Consumers
If you have a REST client producing messages and a JMS consumer,
ActiveMQ REST has a simple helper class for you to transform the HTTP
body to a Java object. Here's some example code:
public void onMessage(Message message)
{
MyType obj = org.apache.activemq.rest.Jms.getEntity(message, MyType.class);
}
The way the `getEntity()` method works is that if the message is an
ObjectMessage, it will try to extract the desired type from it like any
other JMS message. If a REST producer sent the message, then the method
uses RESTEasy to convert the HTTP body to the Java object you want. See
the Javadoc of this class for more helper methods.