Artemis/AMQP Scheduled Delay

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Artemis/AMQP Scheduled Delay

Neil Dunbar
Hi all,

I’m having a bit of trouble using the scheduled delivery function in Artemis (2.6.4) in an AMQP protocol, via the Qpid-Proton Python library.

From what I can tell, this should work (from the simple sender example in the Proton repo)

        from datetime import datetime as dt, timezone as tc

        deltime = int(dt.utcnow().replace(tzinfo=tz.utc).timestamp() * 1000.0) + 120000
        anns = {'x-opt-delivery-time' : deltime}
        while event.sender.credit and self.sent < self.total:
            msg = Message(id=(self.ts * 1000000 + self.sent+1), body={'sequence':(self.sent+1)}, annotations=anns)

            event.sender.send(msg)
            self.sent += 1

The messages are properly queued, but delivered instantly.

I’m guessing that there’s some property which needs to be set at the broker level, but not quite sure what.

No doubt there’s some obvious setting that I’m missing, so would appreciate the help.

Cheers,

Neil
Reply | Threaded
Open this post in threaded view
|

Re: Artemis/AMQP Scheduled Delay

Robbie Gemmell
On the wire, the key in the message annotations map needs to be of
'symbol' type rather than string, with the delivery time value a long.
I havent tried this but for the former I believe something like
"symbol('x-opt-delivery-time')" would be what you need.

On Thu, 9 May 2019 at 16:34, Neil Dunbar
<[hidden email]> wrote:

>
> Hi all,
>
> I’m having a bit of trouble using the scheduled delivery function in Artemis (2.6.4) in an AMQP protocol, via the Qpid-Proton Python library.
>
> From what I can tell, this should work (from the simple sender example in the Proton repo)
>
>         from datetime import datetime as dt, timezone as tc
>
>         deltime = int(dt.utcnow().replace(tzinfo=tz.utc).timestamp() * 1000.0) + 120000
>         anns = {'x-opt-delivery-time' : deltime}
>         while event.sender.credit and self.sent < self.total:
>             msg = Message(id=(self.ts * 1000000 + self.sent+1), body={'sequence':(self.sent+1)}, annotations=anns)
>
>             event.sender.send(msg)
>             self.sent += 1
>
> The messages are properly queued, but delivered instantly.
>
> I’m guessing that there’s some property which needs to be set at the broker level, but not quite sure what.
>
> No doubt there’s some obvious setting that I’m missing, so would appreciate the help.
>
> Cheers,
>
> Neil
Reply | Threaded
Open this post in threaded view
|

Re: Artemis/AMQP Scheduled Delay

Neil Dunbar


> On 9 May 2019, at 18:00, Robbie Gemmell <[hidden email]> wrote:
>
> On the wire, the key in the message annotations map needs to be of
> 'symbol' type rather than string, with the delivery time value a long.
> I havent tried this but for the former I believe something like
> "symbol('x-opt-delivery-time')" would be what you need.

Yup - that was it! Importing symbol from proton._data did the trick.

Thanks!

Neil