It's not a secret anymore!
The moose likes EJB and other Java EE Technologies and the fly likes JMS and Unique ServerID Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS and Unique ServerID" Watch "JMS and Unique ServerID" New topic

JMS and Unique ServerID

Russ Ray
Ranch Hand

Joined: Feb 11, 2003
Posts: 52
I have a simple application that uses a JMS message to update other clustered members of the application. This is a pub/sub scenario. In an effort to prevent duplication of work, I use VMID SERVER_ID = new VMID() to obtain the unique ID for the server who originated the message. I post this information on the queue with no problem. When the message comes off the queue, the MDB takes the current serverID by using VMID SERVER_ID = new VMID(). Next, I compare the two ids.

This application is running on my box, a single JVM/Server, but for some reason I get two separate ServerIDs.

Current ServerID[3c39e4d1cb654eef:39963df5:10563d911b1:-7ffd]
Originating ServerID[3c39e4d1cb654eef:39963df5:10563d911b1:-7ffc]

Am I misusing VMID?

Thanks for your help.

Russell Ray
Ranch Hand

Joined: Apr 25, 2005
Posts: 116
For the good of the group:

VMID is an enterprise way of gaining a unique id. Therefore, each time you can the constructor, a unique id is generated.

I agree. Here's the link:
subject: JMS and Unique ServerID
jQuery in Action, 3rd edition