使用RabbitMQ实现远程对象

时间:2017-05-03 10:27:31

标签: c# .net rabbitmq remoteobject

假设我有一个实际实现驻留在服务中的接口:

public ISomeRemoteObject
{
    void SomeMethod(string arg);
    int SomeMethodWithResult();
}

我希望能够通过AMQP从客户端调用这些方法,最好是RabbitMQ。 我能做的就是:

public RemoteObjectStub : ISomeRemoteObject
{
    public void SomeMethod(string arg)
    {
        //use RabbitMQ to notify service that SomeMethod() has been called with arg parameter
        //and the ID of the object in case there are multiple instances
    }

    public int SomeMethodWithResult()
    {
        //use RabbitMQ RPC to make a synchronous call and get the result
    }
}

另一种方法是创建一个代码生成器,它将接受接口并生成存根。 但我不知道这是否也更好,就像我以前工作的地方一样,我看到人们在努力寻找类似的解决方案。

虽然可能会这些东西,但这不是我的应用程序实际销售的东西,我想避免自己做管道工程。 是否有任何图书馆或项目(付费,免费,开源无关紧要)自动化流程?

0 个答案:

没有答案