You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Alessio Gottardo <ta...@yahoo.it.INVALID> on 2017/11/06 12:25:02 UTC

Electron/Amqp golang packages have an issue with MessageAnnotations() and timestamps

Hi there,

I am having a hard time at parsing this field `MessageAnnotations() map[AnnotationKey]interface{}` from this type: https://godoc.org/qpid.apache.org/amqp#Message when receiving a message.

I am connecting to a Azure Event Hub which is supposed to send some useful annotations that I would like to parse e.g.:

- the field called "x-opt-sequence-number" to retrieve the offset of this message in the partition 
- the field called "x-opt-enqueued-time" for the timestamp

Cf. this for more details: https://github.com/Azure/amqpnetlite/blob/master/docs/articles/azure_eventhubs.md

However at runtime when I attempt at accessing that golang field with `amqpMessage.MessageAnnotations()` then I keep getting a panic message saying: `cannot unmarshal AMQP timestamp to *interface {}`

It seems there is a missing switch-case scenario in here: https://github.com/apache/qpid-proton/blob/go1/amqp/unmarshal.go#L248 

Am I doing anything wrong in the way I am trying to access those AMQP fields? 
How could I try to avoid that panic at line 551 in the "default" case of the switch?
I am not familiar with AMQP and golang so I am wondering if I should do things in a different / more idiomatic way instead.

Thank you
Alessio