Skip to content

How to filter messages #422

Answered by Havret
evarrica asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @evarrica,

To filter messages you need to specify the FilterExpression:

await using IConnection connection = await CreateConnection();
var address = Guid.NewGuid().ToString();

await using IConsumer redMessageConsumer = await connection.CreateConsumerAsync(new ConsumerConfiguration
{
    Address = address,
    RoutingType = RoutingType.Anycast,
    FilterExpression = "color = 'red'"
});
await using IConsumer blueMessageConsumer = await connection.CreateConsumerAsync(new ConsumerConfiguration
{
    Address = address,
    RoutingType = RoutingType.Anycast,
    FilterExpression = "color = 'blue'"
});

You can find more examples here.

Best,
Havret

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by evarrica
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants