Hi Steve,Could you please provide a little more details how those duplicates get generated?
--
You received this message because you are subscribed to the Google Groups "Particular Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to particularsoftw...@googlegroups.com.
To post to this group, send email to particula...@googlegroups.com.
Visit this group at https://groups.google.com/group/particularsoftware.
To view this discussion on the web visit https://groups.google.com/d/msgid/particularsoftware/91e983ac-6728-4218-a107-42855d0b1878%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
public class MessageIdMutator : IMutateOutgoingTransportMessages
{
public void MutateOutgoing(LogicalMessage logicalMessage, TransportMessage transportMessage)
{
var msg = logicalMessage.Instance as Message1;
if (msg != null && !string.IsNullOrEmpty(msg.MessageId))
{
transportMessage.Headers[Headers.MessageId] = msg.MessageId;
}
}
}
public class MutatorConfig : INeedInitialization
{
public void Customize(BusConfiguration configuration)
{
configuration.RegisterComponents(components =>
{
components.ConfigureComponent<MessageIdMutator>(DependencyLifecycle.InstancePerCall);
});
--
You received this message because you are subscribed to the Google Groups "Particular Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to particularsoftw...@googlegroups.com.
To post to this group, send email to particula...@googlegroups.com.
Visit this group at https://groups.google.com/group/particularsoftware.
To view this discussion on the web visit https://groups.google.com/d/msgid/particularsoftware/589c2b40-1e35-4432-8a8e-d66db3105d10%40googlegroups.com.
Steve,Small improvement, as the mutator is stateless you can make the component registration a single instance.Regards,Ramon
On Wed, Mar 16, 2016 at 7:21 PM Steve Winward <steve....@gmail.com> wrote:
In case anyone is curious, here is the code required to get this working. In addition to this code, you also need to make sure that the queue you are using has been created with deduplication enabled. Once you create the queue, you cannot change this. It must be set on creation.public class MessageIdMutator : IMutateOutgoingTransportMessages
{
public void MutateOutgoing(LogicalMessage logicalMessage, TransportMessage transportMessage)
{
var msg = logicalMessage.Instance as Message1;
if (msg != null && !string.IsNullOrEmpty(msg.MessageId))
{
transportMessage.Headers[Headers.MessageId] = msg.MessageId;
}
}
}
public class MutatorConfig : INeedInitialization
{
public void Customize(BusConfiguration configuration)
{
configuration.RegisterComponents(components =>
{
components.ConfigureComponent<MessageIdMutator>(DependencyLifecycle.InstancePerCall);
});
}
}
On Thursday, January 14, 2016 at 9:58:41 AM UTC-5, Steve Winward wrote:--Thank you all for your responses. This helps me out a ton!
On Wednesday, January 13, 2016 at 5:26:29 PM UTC-5, Sean Feldman wrote:To add to that, you can also achieve this by using IMutateOutgoingTransportMessages and setting message ID header to the new value.Note that TransportMessage has an ID property that is a getter w/o setter. Behind the scenes it's just returning the header value for message id.
You received this message because you are subscribed to the Google Groups "Particular Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to particularsoftware+unsub...@googlegroups.com.