The aim is to introduce support for Filter Expressions in the ArtemisNetClient.Testing library.
This functionality will allow users to mimic the behavior of the actual ActiveMQ Artemis message broker in terms of message filtering.
Feature in action
var endpoint = Endpoint.Create("localhost", 5672, "guest", "guest");
using var testKit = new TestKit(endpoint);
var connectionFactory = new ConnectionFactory();
await using var connection = await connectionFactory.CreateAsync(endpoint);
var address = "test_address";
await using var redMessageConsumer = await connection.CreateConsumerAsync(new ConsumerConfiguration
{
Address = address,
RoutingType = RoutingType.Multicast,
FilterExpression = "color = 'red'"
});
await testKit.SendMessageAsync(address, new Message("blue") { ApplicationProperties = { ["color"] = "blue" } });
await testKit.SendMessageAsync(address, new Message("red") { ApplicationProperties = { ["color"] = "red" } });
var redMessage = await redMessageConsumer.ReceiveAsync();
redMessage.ApplicationProperties.TryGetValue<string>("color", out var color); // color=red
Describe alternatives you've considered
One could directly interact with an actual ActiveMQ Artemis broker, but this would defeat the purpose of having a testing library in the first place.
Additional context
By introducing this feature, users will have a seamless and more accurate testing experience, ensuring that the behavior in the testing environment closely matches the production environment.
Feature description
Feature in action
Describe alternatives you've considered
One could directly interact with an actual ActiveMQ Artemis broker, but this would defeat the purpose of having a testing library in the first place.
Additional context
By introducing this feature, users will have a seamless and more accurate testing experience, ensuring that the behavior in the testing environment closely matches the production environment.