Potentially invalid RabbitMQ deliveryTag type.

przemyslaw.szychowski
przemyslaw.szychowski Spryker Customer Posts: 9 🧑🏻‍🚀 - Cadet

Hello,

I found that Spryker defines QueueReceiveMessageTransfer::deliveryTag as string.Is it correct?
RabbitMQ documentation says it is longlong, so shouldn't it be int in PHP?

See https://www.rabbitmq.com/amqp-0-9-1-reference.html#domain.delivery-tag

Comments

  • profuel
    profuel Sprykee Posts: 55 🪐 - Explorer

    hi, @przemyslaw.szychowski !

    That's an interesting finding, though I think it doesn't require any updates in the Vendor code.

    longlong is essentially int(64), and thus it could be safely stored in the string.

    Since the object is not directly related to the RMQ, string type makes it possible to store any value, not only RMQ specific number.

    If you think that due to performance limitations type is important, I suggest you to create an additional field and store integer value there.

    Brief check of the Php AMQP library shows that the change of the type might be needed, once it starts using strict types.

  • przemyslaw.szychowski
    przemyslaw.szychowski Spryker Customer Posts: 9 🧑🏻‍🚀 - Cadet

    Thank you for the answer. You are right, string can store integer, so everything works until strict types are used.

    I found it when I needed to have custom retry/error handling logic and as I'm using strict types, PHP started to throw errors.

    I handled it in my code, but it may be good to make vendor module compatibile with Php AMQP.

  • profuel
    profuel Sprykee Posts: 55 🪐 - Explorer