비동기 SOA를 제공하기 위해 MSMQ를 사용하고 있습니다. 설명하기가 어렵 기 때문에 아래 코드를 참조하십시오. 나는 그것을하는 가장 좋은 방법을 찾아 내려고 노력하고있다.MSMQ 관련 질문 "메시지 처리 방법"
//another method reads off MSMQ and passes the Message into this method
public void ReadMSMQAndAction(Message m)
{
var e = m.Entity;
/* this is really bad, but i some how still need some
* kind of traffic cop to direct action */
switch typeof(m.Entity)
case Order.GetType()
switch e.Action
case "SAVE"
//todo OrderRepo Save
}
//Message gets searlized and put into MSMQ
public class Message<T>
{
public T Entity { get;set; }
/* should this be string?
* or some kind of rule i.e. "ClassName:MethodName" etc? */
public string Action { get;set; }
}
public class OrderRepo
{
public void Save(Order o) { /* todo */ }
public void Delete(Order o) { /* todo */ }
public void Update(Order o) { /* todo */ }
}
코드가 복잡 해짐에 따라 관리하기가 어려울 수 있습니다. 어떤 제안이라도 환영합니다!
감사합니다. 왜 내가 대의원을 생각하지 않았어. – Jeff
하지만 실제로 내가 생각했던 것은 백엔드가 클라이언트에 투명하게되기를 원했기 때문입니다. 즉, OrderRepo가 클라이언트에 노출되지 않을 수도 있고, 클라이언트에 대한 메커니즘을 가지고 있고 지시를 교환하기를 원합니다. – Jeff
논리가 DLL에 있다면 앞/뒤 모두를 공유 할 수 있습니다. – cjk