Manage multiple UDP calls

Posted by rayman on Stack Overflow See other posts from Stack Overflow or by rayman
Published on 2010-12-30T16:57:07Z Indexed on 2010/12/31 11:53 UTC
Read the original article Hit count: 317

Filed under:
|
|
|
|

Hi all, I would like to have an advice for this issue: I am using Jbos 5.1.0, EJB3.0

I have system, which sending requests via UDP'S to remote modems, and suppose to wait for an answer from the target modem. the remote modems support only UDP calls, therefor I o design asynchronous mechanism. (also coz I want to request X modems parallel)

this is what I try to do:

all calls are retrieved from Data Base, then each call will be added as a message to JMS QUE. let's say i will set X MDB'S on that que, so I can work asynchronous. now each MDB will send UDP request to the IP-address(remote modem) which will be parsed from the que message.

so basicly each MDB, which takes a message is sending a udp request to the remote modem and [b]waiting [/b]for an answer from that modem.

[u]now here is the BUG:[/u]

could happen a scenario where MDB will get an answer, but not from the right modem( which it requested in first place).

that bad scenario cause two wrong things:

a. the sender which sent the message will wait forever since the message never returned to him(it got accepted by another MDB). b. the MDB which received the message is not the right one, and probablly if it was on a "listener" mode, then it supposed to wait for an answer from diffrent sender.(else it wouldnt get any messages)

so ofcourse I can handle everything with a RETRY mechanisem. so both mdb's(the one who got message from the wrong sender, and the one who never got the answer) will try again, to do thire operation with a hope that next time it will success.

This is the mechanism, mybe you could tell me if there is any design pattren, or any other effective solution for this problem?

Thanks,

ray.

© Stack Overflow or respective owner

Related posts about java

Related posts about j2ee