I have a use case where I need to convert a message from one type to another (i.e. TextMessage
-> ObjectMessage
).
I found that when diverting between queues there is an option to transform the message. I have implemented the Transformer
interface as instructed in the documentation.
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.core.server.transformer.Transformer;
import javax.jms.ObjectMessage;
public class TypeTransformer implements Transformer {
@Override
public Message transform(Message message) {
return message;
}
}
But I am now beginning to realize that it might be impossible to convert from a org.apache.activemq.artemis.api.core.Message
to an javax.jms.ObjectMessage
?
Is this right? That it cannot be done or is there some other way?