[rabbitmq-discuss] Erlang client and properties

Edwin Fine rabbitmq-discuss_efine at usa.net
Fri Nov 7 23:07:57 GMT 2008


Ok, I found the definitions for timestamp and so on. Seems like reading the
AMQP 0.8 XML document alone was a mistake; I needed to look at the low-level
protocol in the AMQP 0.8 PDF document. I was skipping between so many docs I
got a bit lost. So I guess RTFM comments would be deserved :) That being
said, is it just me, or is this set of specs a bit difficult to absorb?

So we can scratch question 2 and any questions about shortstr etc. I am
working on reading the rabbit code about message headers. Looks as if some
helper functions in the client might be useful, otherwise I'll be using
internal things like a list of tuples {FName, timestamp/other types, Value}
to create message headers. Is that what is supposed to be done?

On Fri, Nov 7, 2008 at 5:31 PM, Edwin Fine
<rabbitmq-discuss_efine at usa.net>wrote:

> 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/f61e0be9/attachment.htm 


More information about the rabbitmq-discuss mailing list