GithubHelp home page GithubHelp logo

Encoding a message_id as a uuid type. about rhea HOT 6 CLOSED

amqp avatar amqp commented on August 16, 2024
Encoding a message_id as a uuid type.

from rhea.

Comments (6)

amarzavery avatar amarzavery commented on August 16, 2024
  • Based on this test, it looks like rhea will automatically serialize message_id as uuid type.
  • For explicitly wrapping it as uuid you can take a look at this test.

from rhea.

anthonyvercolano avatar anthonyvercolano commented on August 16, 2024

Ok, I changed the title. Given an arbitrary property, what would be the recommended method for serializing out that property with the 0x98 encoding code followed by the 16 bytes of data.

from rhea.

grs avatar grs commented on August 16, 2024

rhea.types.wrap_uuid(x)

from rhea.

anthonyvercolano avatar anthonyvercolano commented on August 16, 2024

Torn between starting a new topic and simply continuing this one. Chose continue.

Gordon, what is your current understanding WITHOUT the pull request I submitted last week.

Talking about sending first.

When sending a message -
Are message_id and correlation_id treated special?
If I set these properties to a simple number will it be serialized as a ulong (of appropriate size)?
If I set these properties to a simple string (that doesn't look like a uuid), will it be set to one of the counted utf-8 string types?
If I place a string in the either of these _id fields that look like a uuid is it going to be serialized as type uuid (with encoding code of 0x98)?
If I place a buffer of length 16 bytes (which are returned by utils.uuid4()) in either of these _id fields will be be sent as a 0x98?
If I place a buffer of length 16 bytes (which are returned by utils.uuid()) in either of these _id fields will be be sent as an array?
If I force some arbitrary property (not correlation_id or message_id)

When receiving a message:
When receiving a message that contains a property that utilizes the encoding code of 0x98 the property
into which it is placed will use:
A 16 byte array?
A string?

from rhea.

grs avatar grs commented on August 16, 2024

Are message_id and correlation_id treated special?

Yes, in so far as they are properties that can take one of three defined types.

If I set these properties to a simple number will it be serialized as a ulong (of appropriate size)?

Yes

If I set these properties to a simple string (that doesn't look like a uuid), will it be set to one of the counted utf-8 string types?

Yes

If I place a string in the either of these _id fields that look like a uuid is it going to be serialized as type uuid (with encoding code of 0x98)?

No, it will only be serialized as a uuid if it is a Buffer.

If I place a buffer of length 16 bytes (which are returned by utils.uuid4()) in either of these _id fields will be be sent as a 0x98?

Yes

If I place a buffer of length 16 bytes (which are returned by utils.uuid()) in either of these _id fields will be be sent as an array?

Assuming you mean uuid4(), then no, they will be sent as a uuid. (An array is not a valid type for message_id or correlation_id).

If I force some arbitrary property (not correlation_id or message_id)

To send an application property, message- or delivery- annotation, or a field in a structured body as a UUID (i.e. 0x98 typecode) you need to explicitly tag it as such using types.wrap_uuid().

When receiving a message:
When receiving a message that contains a property that utilizes the encoding code of 0x98 the property into which it is placed will use:
A 16 byte array?

Yes

A string?

No, though you can get the string using util.uuid_to_string()

from rhea.

anthonyvercolano avatar anthonyvercolano commented on August 16, 2024

Thank for all the information. It simplified what I was trying to do.

from rhea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.