Jiri Daněk created PROTON-2616:
----------------------------------
Summary: 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
I wish to set a message selector for my message receiver
{code}
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}
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}
// ...
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]