I'm learning about MsmqIntegrationBinding. All the samples and guidelines I've seen so far were covering scenario where, there is just one operation with one data contract. I tried to add another contract and the service started successfully. However I cannot figure out how to reach the second operation. Is such thing even possible with this binding?
[ServiceContract]
[ServiceKnownType(typeof(Data1))]
[ServiceKnownType(typeof(Data2))]
public interface ISampleService
{
[OperationContract(IsOneWay = true, Action = "*")]
void Operation1(MsmqMessage<Data1> msg);
[OperationContract(IsOneWay = true)]
void Operation2(MsmqMessage<Data2> msg);
}
public class SampleService : ISampleService
{
[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
public void Operation1(MsmqMessage<Data1> msg)
{
var data = msg.Body;
}
[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
public void Operation2(MsmqMessage<Data2> msg)
{
var data = msg.Body;
}
}
Calling code
var queue = new MessageQueue(@".\private$\samplequeue");
var body = new Data1() { Data = "some data" };
var message = new Message(body);
message.Label = "some label";
queue.Send(body, MessageQueueTransactionType.Single);
This will fire the Operation1 which has Action set to "*".