[rabbitmq-discuss] Erlang client and properties

Edwin Fine rabbitmq-discuss_efine at usa.net
Fri Nov 7 22:31:12 GMT 2008


Hi all,

I'm using the Erlang client (2008/06/23 vintage, I think) and I've started
to need message-related properties like timestamp, expiration, and so on, to
avoid reinventing the wheel. The Java client's Javadoc I am not finding very
helpful for this set of questions. I know that the Erlang client is still
experimental, so I am asking for "documentation" here (* see the end of this
post before sending STFW messages, please :)

If the following questions are answered somewhere in a way that relates to
how to use it in the Erlang client (e.g. examples in Erlang), please point
me to it and disregard the rest of these questions.

My questions are:

   1. When I send a message with properties set to
   amqp_util:basic_properties(), and receive it using a basic.get, the message
   has only got property data in properties_bin, but properties is set to
   'none'. How do I decode what's in properties_bin? Alternatively, how do I
   get the properties to stay set in the unencoded 'properties' field?
   2. What is the format of the timestamp field, and how do I encode/decode
   it? I can't find a definition for its type "timestamp" in the AMQP spec.
   3. When and by what does the timestamp get set? I searched all the client
   code for 'timestamp' but could not find it, so when I create a new message,
   what sets this?
   4. What is the format of the expiration? The spec does not define it.
   5. What is the behavior when a message has expired? Does the client
   automatically throw it away when doing a basic.get or consume so I never see
   it?
   6. Does the message_id ever get set automatically to a unique value?
   7. What is the purpose of the 'type' property? The spec just writes
   "message type name"? Is this totally user-defined?
   8. How does one set and get message headers?

I am sure that I could work this all out if I read all the Rabbit code, all
the AMQP tutorials I can find, and so on, but it would take me days. It's
already taken hours so far. If anyone can help me shortcut this, I would be
very grateful.

Regards,
Edwin Fine
----------
* For those who believe I should RTFM or STFW, I hear you, and I have done
my best in the time I have available. This is what I have done and/or
learned:

I looked in the Erlang client and server code, too, but found little to
help, besides this in amqp_util.erl:

basic_properties() ->
    #'P_basic'{content_type = <<"application/octet-stream">>, delivery_mode
= 1, priority = 0}

>From rabbit_framing.hrl, I got this:

-record('P_basic', {content_type, content_encoding, headers, delivery_mode,
priority, correlation_id, reply_to, expiration, message_id, timestamp, type,
user_id, app_id, cluster_id}).

The above fields are described in the amqp0-8.xml document in terms of their
basic type (e.g. shortstr, whatever that is) and their purpose. The basic
types (shortstr, timestamp, etc) are not explained in the document, nor can
I find a reference to anything that does explain them. I saw in the Rabbit
code an assertion that shortstr length must be < 256, so now I know that :)

In the Javadoc, only the content_type, delivery_mode, and priority fields
seem to be used in the MessageProperties class. The descriptions of each of
the properties in Basic.Properties are absent.

I searched the Rabbit message list archives, too. One of the messages
pointed me to a tutorial in C, which was useful to see how some of the
properties were used (http://www.openamq.org/tutorial:soa). Now I understand
that I have to set the message_id myself, and that the routing key of the
sender should be put into reply_to if the sender requires a reply, in other
words, the routing key of the responder must be set to the sender's reply_to
property.

I am still looking through the C code tutorials, so maybe I will find out
more.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20081107/e88644de/attachment.htm 


More information about the rabbitmq-discuss mailing list