[
https://issues.apache.org/activemq/browse/AMQNET-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61188#action_61188
]
Timothy Bish commented on AMQNET-271:
-------------------------------------
Events allow for multiple subscribers which you definitely don't want in this
case. Plus I always find the event / delegate model in .NET to be a bit
annoying as I have to read a book every time I want to use them.
The purpose of this feature is to allow client to configure a producer or
consumer to transform a message into something they understand, for instance a
client could use to send say an IStreamMessage which they know a Stomp client
is listening on an have the MessageProducer apply the transform on the fly to
convert it to a TextMessage encoded in a way the Stomp client can process. Or
it could be used just as a means of content enrichment.
I don't think that you'd want to multicast that given that each receiver could
return their own converted message. Which one would you end up sending?
We could of course provide a default implementation that overrides both and
return null (null right now in my code just means use the original), then the
user can use that to allow them to only implement the transform method they
wanted. Plus this could add some extra code like helpers to copy standard NMS
headers etc from the old to the new message.
I had also intended to use this interface to create a generic NMS message
Transformer that the client could use to transform NMS messages commands from
one client to the command type that's needed in another. For example, the
NMS.ActiveMQ client could accept ITextMessage from a MSMQ client and internally
transform it into the NMS.ActiveMQ ITextMessage implementation.
If there's some slick .NETy way of doing all this then feel free to comment,
just make sure it works on the .NETCF 2.0 framework so it can run in NMS.Stomp
:)
Just wanted to get the ball rolling on something so nothing set in stone right
now, comment away....
> Add support for a Message Transformer to be set in NMS API
> ----------------------------------------------------------
>
> Key: AMQNET-271
> URL: https://issues.apache.org/activemq/browse/AMQNET-271
> Project: ActiveMQ .Net
> Issue Type: Improvement
> Components: ActiveMQ, EMS, MSMQ, NMS, Stomp
> Affects Versions: 1.3.0
> Reporter: Timothy Bish
> Assignee: Timothy Bish
> Priority: Minor
> Fix For: 1.4.0
>
>
> Add support in the NMS API for users to set an custom MessageTransformer on
> the NMS object:
> IConnectionFactory
> IConnection
> ISession
> IMessageProducer
> IMessageConsumer
> The transformer would be an instance of IMessageTransformer which provides
> two methods:
> {noformat}
> /// <summary>
> /// Interface for a class that can Transform a Message from one type to
> another either
> /// before consumption or before sent by a producer.
> /// </summary>
> public interface IMessageTransformer
> {
> /// <summary>
> /// Called from an IMessageProducer prior to sending the IMessage,
> allows the client
> /// to perform a transformation on the Message prior to it being
> sent. This allows a
> /// client to configure a single Producer to convert a Message to a
> format that can be
> /// processed by a specific receiving client.
> /// </summary>
> IMessage ProducerTransform(ISession session, IMessageProducer
> producer, IMessage message);
> /// <summary>
> /// Called from an IMessageConsumer prior to dispatching the message
> to the client either
> /// by the 'Receive' methods or from the async listener event.
> Allows the client to perform
> /// message pre-processing before some messages are dispatched into
> the client code.
> /// </summary>
> IMessage ConsumerTransform(ISession session, IMessageConsumer
> producer, IMessage message);
> }
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.