views:

86

answers:

1

I am developing a solution with multiple WCF services which all communicate among themselves, even though they are of different types. The services connect to one another through the ChannelFactory generic interface, and every service is hosted inside a ServiceHost.

My question is if it would be correct to use a callback contract among the servers to communicate with one another and if so how would such a solution look.

Currently I don't like the implementation because every service needs to host a couple of endpoints with different interfaces some for other services and some for other clients.

When I tried to implement the callback contract inside a service class that was hosted inside a ServiceHost it failed.

A: 

First of all, whenever you post a question saying, "it failed", you need to tell us in what way it failed. If there was an exception, then you need to post the entire exception, including all InnerException instances, by posting the result of ex.ToString().

To your problem, I'd implement a service contract that represents the part of each service that needs to talk to the other services. There would also be a callback contract associated with this service contract.

That way, it's as though each service operates a miniature service intended only for service-to-service communications. They can then each do their own thing with the information that is passed between the services.

John Saunders
In the case you mentioned, lets say every service hosts it's interface in a a service host. where would i put the callbacks for the other process to connect to?what i mean is that the type ISomeMessage would be hosted by the SomeMessageService through a ServiceHost. what would implement the IServiceMesssageCallback ?Btw im avoiding the use of a crud generated proxy.
totem
I see no reason that the callback could not be implemented by the same service class. Also, remember that each service could have its own unique implementation of the service contract.
John Saunders