[
https://issues.apache.org/jira/browse/PROTON-2616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17612817#comment-17612817
]
ASF subversion and git services commented on PROTON-2616:
---------------------------------------------------------
Commit a5712ccd2370cc066ca4c11c3c1c17001d824fcd in qpid-protonj2's branch
refs/heads/main from Timothy Bish
[ https://gitbox.apache.org/repos/asf?p=qpid-protonj2.git;h=a5712ccd ]
PROTON-2616 Relax filters API to accept Map with object entries
Allows for AMQP types or custom DescribedType entries in the map which
allows for definition of JMS AMQP style selectors or other custom
selector types based on the remote handling of selectors.
> Can't use `receiverOptions.sourceOptions().filters()` to set message selector
> for Artemis broker
> ------------------------------------------------------------------------------------------------
>
> Key: PROTON-2616
> URL: https://issues.apache.org/jira/browse/PROTON-2616
> Project: Qpid Proton
> Issue Type: Bug
> Components: protonj2
> Affects Versions: protonj2-1.0.0-M9
> Reporter: Jiri Daněk
> Assignee: Timothy A. Bish
> Priority: Major
>
> I wish to set a message selector for my message receiver
> {code:java}
> String selector = "...";
> receiverOptions.sourceOptions().filters(Map.of("apache.org:selector-filter:string",
> selector));
> {code}
> Looking at the filters() function, it requires a Map<String, String>.
> On the broker side, the code does not look at what's in the key at all, and
> it requires a DescribedType to be the value. I have no way to send
> DescribedType with ProtonJ2, as far as I can tell.
> What I think I need (given the broker code below) is something like this
> {code:java}
> DescribedType describedType = new
> UnknownDescribedType(Symbol.getSymbol("apache.org:selector-filter:string"),
> selector);
> receiverOptions.sourceOptions().filters(Map.of("selector", describedType));
> {code}
> (Using {{0x0000468C:0x00000004}} as the descriptor, instead of a symbol, is
> going to be more space-efficient.)
> [https://github.com/apache/activemq-artemis/blob/d7f37ae313bd3f26ed58ee08d2ca562c604b04b1/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AmqpSupport.java#L133-L148]
> {code:java}
> // ...
> for (Map.Entry<Symbol, Object> filter : filters.entrySet()) {
> if (filter.getValue() instanceof DescribedType) {
> DescribedType describedType = ((DescribedType) filter.getValue());
> Object descriptor = describedType.getDescriptor();
> for (Object filterId : filterIds) {
> if (descriptor.equals(filterId)) {
> return new
> AbstractMap.SimpleImmutableEntry<>(filter.getKey(), describedType);
> }
> }
> }
> }
> return null;
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]