aspose file tools
The moose likes Java in General and the fly likes Architecture advice about handling multiple UDP calls Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

Architecture advice about handling multiple UDP calls

ray frid
Ranch Hand

Joined: Dec 23, 2010
Posts: 79
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 waiting for an answer from that modem. (each modem send response to the ip which requested it, via the header)

now here is the BUG:

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?


Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3383

Welcome to JavaRanch Ray,

Please CarefullyChooseOneForum when you post a question. I'm closing this one for you - please continue the discussion on your other topic.

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
I agree. Here's the link:
subject: Architecture advice about handling multiple UDP calls