开发者

http interface for long operation

I have a running system that process short and long running opera开发者_运维百科tions with a Request-Response interface based on Agatha-RRSL.

Now we want to change a little in order to be able to send requests via website in Json format so i'm trying many REST server implementation that support Json. REST server will be one module or "shelve" handled by Topshelf, another module will be the processing module and the last the NoSQL database runner module.

To talk between REST and processing module i'm thinking about a servicebus but we have two types of request: short requests that perform work in 1-2 seconds and long requests that do work in 1 minute..

Is servicebus the right choice for this work? I'm thinking about returning a "response" for long running op with a token that can be used to request operation status and results with a new request. The problem is that big part of the requests must be used like sync request in order to complete http response.

I think I have also problems with response size (on MSMQ message transport) when I have to return huge list of objects

Any hint?


NServiceBus is not really suitable for request-response messaging patterns. It's more suited to asynchronous publish-subscribe.

Edit: In order to implement a kind of request response, you would need to message in both directions, but consisting of three logical steps:

  1. So your client sends a message requesting the data.
  2. The server would receive the message, process it, construct a return message with the data, and send it to the client.
  3. The client can then process the data.

Because each of these steps takes place in isolation and in an asynchronous manner there can be no meaningful SLA or timeout enforced between when a client sends a request and receives a response. But this works nicely for large processing job which may take several minutes to complete.

Additionally a common value which can be used to tie the request to the response will need to be present in both messages. Otherwise a client could send more than one request, and receive multiple responses and not know which response was for which request.

So you can do this with NServiceBus but it takes a little more thought.

Also NServiceBus uses MSMQ as the underlying transport, not http.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜