[ 
https://issues.apache.org/jira/browse/PROTON-1450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15959041#comment-15959041
 ] 

Alan Conway commented on PROTON-1450:
-------------------------------------

Thanks again, I am looking at 
https://github.com/recobe182/gohub/blob/master/filter_anno.patch, let me know 
if that is not the right patch.

I think all your ideas are good, and you've pointed out some other flaws I will 
address regarding detailed AMQP protocol support. Here's my thinking so far, 
please let me know if this makes sense and suits your needs or if you have 
other ideas:

1. Filter goes TerminusSettings, not directly on LinkSettings. A link's Source 
and Target can both have filters.

2. `type Filter map[Symbol]interface{}` rather than `map[string]string` to 
follow AMQP spec.

`Symbol` is just `type Symbol string` so converts to or from string but is 
encoded as AMQP symbol.  The AMQP spec allows other types (not just string) to 
be used as values in filter maps: you can still use `string` for your 
application and the encoding will be the same, but interface{} allows other 
types in future.

3. Annotations: your patch points out a bug here - AMQP annotation keys can be 
symbol OR ulong, so map[string] is not accurate. Your patch fixes the encoding 
correctly, but the API is still wrong since you can't set or get ulong keys. I 
propose to leave the existing Annotation method (with your encoding fix) for 
backwards compatibility and add new methods like:

    func (Message) MessageAnnotations() map[AnnotationKey]interface{}

My proposal for the AnnotationKey type is at: 
https://groups.google.com/forum/#!topic/golang-nuts/SsjSEqVcVqQ

So code that uses the old Annotation methods will still work (with the correct 
encoding) but the new method will be recommended for the future.

As an added bonus, the new methods are more consistent with C++ and other 
bindings.

Thoughts?

Side note: The AMQP spec says filter values should be "described types" - if 
Azure is happy with plain strings then don't change anything, but it might come 
up in future. The go library doesn't have described type support yet: 
https://issues.apache.org/jira/browse/PROTON-1456


> Add Filter LinkOption to Electron API
> -------------------------------------
>
>                 Key: PROTON-1450
>                 URL: https://issues.apache.org/jira/browse/PROTON-1450
>             Project: Qpid Proton
>          Issue Type: Improvement
>          Components: go-binding
>            Reporter: Kale Blankenship
>            Assignee: Alan Conway
>
> There doesn't appear to be a way to set filters with the current Go bindings. 
> Microsoft's Event Hubs use filters to indicate the starting offset of 
> messages 
> (http://azure.github.io/amqpnetlite/articles/azure_eventhubs.html#filter). 
> Without this option it would be difficult to properly use the bindings with 
> Event Hubs.
> There is a wrapper which patches the bindings to provide the functionality 
> here: https://github.com/recobe182/gohub. Though I am not familiar enough 
> with Qpid to determine if the patch is reasonable.
> Thank you for considering this request and creating/maintaining this project!



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to