Hello,
we are currently using a Transformer to redirect Event messages into a
queue to consume them as kind of Unique Processing by distributed
applications.
For this we use a transformer:
public class PrefixAddressTransformer implements Transformer
{
@Override
public Message transform(Message message)
{
SimpleString originalAddress =
(SimpleString)message.getBrokerProperty(Message.HDR_ORIGINAL_ADDRESS);
message.setAddress(message.getAddress() + "."
+originalAddress.toString());
return message;
}
}
That we use with with a divert:
<diverts>
<divert name="test-events-divert">
<address>test.events.#</address>
<forwarding-address>TestQ</forwarding-address>
<exclusive>true</exclusive>
<transformer-class-name>org.apache.activemq.artemis.core.server.transformer.PrefixAddressTransformer</transformer-class-name>
</divert>
</diverts>
So that all messages on test.events.# are also sent to a queue
TestQ.test.events... and can be processed in a distributed manner.
Others might also profit from this, so we wanted to commit it to the
offical artemis repo.
Should there be testing done on this transformer, like with the
org.apache.activemq.artemis.core.server.transformer.AddHeadersTransformer,
which is tested in
org.apache.activemq.artemis.tests.integration.management.DivertControlTest
?
best regards
Maximilian Rieder