Return-Path: Delivered-To: apmail-qpid-users-archive@www.apache.org Received: (qmail 23968 invoked from network); 27 Jul 2009 14:00:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 Jul 2009 14:00:39 -0000 Received: (qmail 1773 invoked by uid 500); 27 Jul 2009 14:01:44 -0000 Delivered-To: apmail-qpid-users-archive@qpid.apache.org Received: (qmail 1730 invoked by uid 500); 27 Jul 2009 14:01:44 -0000 Mailing-List: contact users-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@qpid.apache.org Delivered-To: mailing list users@qpid.apache.org Received: (qmail 1718 invoked by uid 99); 27 Jul 2009 14:01:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jul 2009 14:01:44 +0000 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jonathan.robie@redhat.com designates 66.187.237.31 as permitted sender) Received: from [66.187.237.31] (HELO mx2.redhat.com) (66.187.237.31) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jul 2009 14:01:36 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6RE1F49010083 for ; Mon, 27 Jul 2009 10:01:15 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6RE1Eep010161 for ; Mon, 27 Jul 2009 10:01:15 -0400 Received: from localhost.localdomain (vpn-10-78.bos.redhat.com [10.16.10.78]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6RE1D48007002 for ; Mon, 27 Jul 2009 10:01:14 -0400 Message-ID: <4A6DB329.2020004@redhat.com> Date: Mon, 27 Jul 2009 10:01:13 -0400 From: Jonathan Robie User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: users@qpid.apache.org Subject: Re: Message and MessageTransfer References: <1248698930011-3333616.post@n2.nabble.com> In-Reply-To: <1248698930011-3333616.post@n2.nabble.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-Virus-Checked: Checked by ClamAV on apache.org 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-subscribe@qpid.apache.org