My subscriber queue isn't picking up messages. It looks like they're ending up in the error queue.
The only unusual aspect to this is that the publisher is receiving messages which are generated from a website (and then a class library) which are then WCF'd to the publisher who publishes on behalf of the website/class library.
If I remove the publisher's <add Messages="">
then I get an error saying the publisher doesn't know where to route the messages.
No destination specified for message Messages.ContactRequest. Message cannot be sent. Check the UnicastBusConfig section in your config file and ensure that a MessageEndpointMapping exists for the message type.
Help! I've almost cut'n'pasted the WcfIntegration and PubSub samples, so I don't know why it isn't working!
PUBLISHER:
<MsmqTransportConfig
InputQueue="RSApp_InputQueue"
ErrorQueue="error"
NumberOfWorkerThreads="1"
MaxRetries="5"
/>
<UnicastBusConfig
DistributorControlAddress=""
DistributorDataAddress=""
ForwardReceivedMessagesTo="">
<MessageEndpointMappings>
<add Messages="Messages" Endpoint="RSApp_InputQueue" />
</MessageEndpointMappings>
</UnicastBusConfig>
SUBSCRIBER:
<!-- SUBSCRIBER -->
<MsmqTransportConfig
InputQueue="RSApp_SubscriberQueue"
ErrorQueue="error"
NumberOfWorkerThreads="1"
MaxRetries="5"
/>
<UnicastBusConfig
DistributorControlAddress=""
DistributorDataAddress=""
ForwardReceivedMessagesTo="">
<MessageEndpointMappings>
<add Messages="Messages" Endpoint="RSApp_InputQueue" />
</MessageEndpointMappings>
</UnicastBusConfig>
p.s. does the WCF endpoint automatically created by nservicebus also automatically bus.publish<>() the message?
p.s. I don't understand what I need to do with this:-
[ServiceContract] public interface IContactRequestService { [OperationContract(Action = "http://tempuri.org/IWcfServiceOf_ContactRequest_ErrorCodes/Process", ReplyAction = "http://tempuri.org/IWcfServiceOf_ContactRequest_ErrorCodes/ProcessResponse")] ErrorCodes Process(Messages.ContactRequest request); }
Here's my client calling code:-
public void MakeContactRequest(int id, Guid RequestingUserId, Guid RequesteeUserId, Messages.ContactRequestType type)
{
//get extra information
var u = Services.UserService.FetchUserProfile(id);
//add it to local database
var RequestIdentifier = Guid.NewGuid();
//create message
var req = new ContactRequest()
{
contactRequestType = type,
Name = u.DisplayName,
RequestCreationDate = DateTime.Now,
TagLine = u.Tagline,
RequesterUserId = RequestingUserId,
RequesteeUserId = RequesteeUserId,
RequestIdentifier = RequestIdentifier
};
//drop it onto distributed message queue
IContactRequestService client = ChannelFactory.CreateChannel();
try
{
ErrorCodes returnCode = client.Process(req);
}
finally
{
try
{
((IChannel)client).Close();
}
catch
{
((IChannel)client).Abort();
}
}
}
What is wierd is that putting a message on the bus without using WCF works a treat!!
public void Run()
{
Console.WriteLine("This will publish IEvent and EventMessage alternately.");
Console.WriteLine("Press 'Enter' to publish a message.To exit, Ctrl + C");
bool publishIEvent = true;
while (Console.ReadLine() != null)
{
var eventMessage = publishIEvent ? Bus.CreateInstance<ContactRequest>() : new ContactRequest();
Bus.Publish(eventMessage);
Console.WriteLine("Published event ");
publishIEvent = !publishIEvent;
}