Hi Jonathan, I'm using AMQP API because I need to declare exchanges and I didn't find out how to do this using the JMS interface, if it were possible to declare exchanges with JMS I'll use it.
Ricard. Jonathan Robie wrote: > > Ricard, > > The Java AMQP API is not widely used, most Java programmers are using > the Java JMS interface. It is also not well documented, grepping for > "Properties" in the examples can help give you an overview if you really > want to use this API (see below). > > I haven't tried this, but I imagine MessageProperties are handled the > same way as DeliveryProperties: > > public void message(Session ssn, MessageTransfer xfr) > { > DeliveryProperties dp = xfr.getHeader().get(DeliveryProperties.class); > System.out.println("Message: " + xfr + " with routing_key " + > dp.getRoutingKey()); > } > > Here is the overview for handling properties that I got by using grep on > the examples: > > $ pwd > /home/jrobie/qpid/java/client/example/src/main/java/org/apache/qpid/example/amqpexample > > $ grep Properties */*.java > direct/DirectProducer.java:import > org.apache.qpid.transport.DeliveryProperties; > direct/DirectProducer.java: DeliveryProperties deliveryProps = new > DeliveryProperties(); > fanout/FannoutProducer.java:import > org.apache.qpid.transport.DeliveryProperties; > fanout/FannoutProducer.java: DeliveryProperties deliveryProps = new > DeliveryProperties(); > headers/Producer.java: DeliveryProperties deliveryProps = new > DeliveryProperties(); > headers/Producer.java: MessageProperties messageProperties = new > MessageProperties(); > headers/Producer.java: > messageProperties.setApplicationHeaders(messageHeaders); > headers/Producer.java: Header header = new Header(deliveryProps, > messageProperties); > headers/Producer.java: messageProperties = new MessageProperties(); > headers/Producer.java: > messageProperties.setApplicationHeaders(messageHeaders); > headers/Producer.java: header = new Header(deliveryProps, > messageProperties); > lvq/Producer.java: DeliveryProperties deliveryProps = new > DeliveryProperties(); > lvq/Producer.java: MessageProperties messageProperties = new > MessageProperties(); > lvq/Producer.java: > messageProperties.setApplicationHeaders(messageHeaders); > lvq/Producer.java: Header header = new Header(deliveryProps, > messageProperties); > pubsub/TopicListener.java:import > org.apache.qpid.transport.DeliveryProperties; > pubsub/TopicListener.java: DeliveryProperties dp = > xfr.getHeader().get(DeliveryProperties.class); > pubsub/TopicPublisher.java:import > org.apache.qpid.transport.DeliveryProperties; > pubsub/TopicPublisher.java: DeliveryProperties deliveryProps = new > DeliveryProperties(); > pubsub/TopicPublisher.java: new Header(new > DeliveryProperties().setRoutingKey("control")), > > Hope this helps! > > Jonathan > > > ricardlf wrote: >> Hi, >> I'm starting to get used to Qpid but there is still something that is not >> completely clear to me. How do I get message properties of a message? I >> mean, in the java amqp examples, when the producer sends a message and >> when >> the consumer gets it, both use MessageTransfer class objects for sending >> and >> getting the message, but this class doesn't have getMessageProperties, so >> I >> don't know how to get for example replyTo propertie from an object of >> this >> class. >> I've seen that qpid has a class called Message, but this class doesn't >> have >> a body propertie, so I don't know how to put some content in it, and I >> don't >> know even if I can send an instance of Message using >> session.MessageTransfer. >> Please, could anyone help me with this confussion or tell me where I can >> find an explanation? Thank you so much. >> >> Ricard. >> > > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:users-subscr...@qpid.apache.org > > > -- View this message in context: http://n2.nabble.com/Message-and-MessageTransfer-tp3333616p3339707.html Sent from the Apache Qpid users mailing list archive at Nabble.com. --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org