qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessio Gottardo <tappo...@yahoo.it.INVALID>
Subject Re: Electron/Amqp MessageAnnotations in Golang
Date Fri, 10 Nov 2017 12:10:16 GMT
 Thank you Alan, very much appreciated :)
Out of curiosity is there a specific reason for `panic`ing in the `default` case instead of
returning an `error`?I just became aware of this `recover` mechanism in go to handle a runtime
`panic` thrown somewhere else, but that's going to make the code quite a bit more complicated. I
was wondering if it would have been easier to return an error to whoever uses the `amqp`
go wrapper, but I see that could have quite of an impact on the codebase as it is at the moment.
Thank you for the fix.Alessio
    On Thursday, 9 November 2017, 20:17:41 GMT, Alan Conway <aconway@redhat.com> wrote:
 Apologies for the long delay, this is a bug and was reported previously:

I am fixing it now, watch the JIRA to be notified when it is fixed. You can
get the latest code direct from git, the "go get" repo will be updated with
the next release of proton, which should be fairly soon.

On Mon, Nov 6, 2017 at 6:29 AM, Alessio Gottardo <tappoz84@yahoo.it.invalid>

> 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
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message