You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Timothy A. Bish (Jira)" <ji...@apache.org> on 2022/10/04 22:41:00 UTC
[jira] [Resolved] (PROTON-2616) Can't use `receiverOptions.sourceOptions().filters()` to set message selector for Artemis broker
[ https://issues.apache.org/jira/browse/PROTON-2616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timothy A. Bish resolved PROTON-2616.
-------------------------------------
Fix Version/s: protonj2-1.0.0-M10
Resolution: Fixed
> 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
> Fix For: protonj2-1.0.0-M10
>
>
> 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: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org