3 Replies Latest reply on Dec 5, 2006 4:02 PM by Zoltan Glozik

    JBossCache as a message oriented middleware?

    Zoltan Glozik Newbie


      We are working on a distributed Java-based application where processes running in different JVMs need to carry out certain tasks as a response to certain events. One design option is to use a message oriented middleware where processes can publish events and subscribers can choose to listen to them and execute the appropriate actions.

      We were thinking about JBossCache instead of a MOM, where the publisher can just change a shared data structure, which is replicated to other processes, and the other processes can choose to listen for changes in the data structure. My question is whether any other JBossCache users can see any problems with this design approach. E.g. not all processes will be interested in all the shared data structures, is it possible for a process to select for which data structures they receive updates to minimise network traffic/memory resource usage? (like subscribing to a topic in a MOM)

      Any comments appreciated.


        • 1. Re: JBossCache as a message oriented middleware?
          Brian Stansberry Master

          Can you divide your data between different caches? I.e. if on servers 1 and 2, there are processes running that are interested in data structures A, B, and C, then you deploy CacheA, CacheB and CacheC. On servers 3 and 4, the running process are interested in B, C and D, so CacheB, CacheC and CacheD are deployed.

          Another possibility is to use the activateRegion() API. There you have just one cache, but it has regions /A, /B, /C and /D. On servers 1 and 2, region /D isn't activated, and thus the cache ignores replication traffic for /D. On servers 3 and 4, /A isn't activated.

          The multiple-cache approach has the advantage that no JGroups channel on servers 1 and 2 even sees replication messages for D. With the region-based approach, the channel sees the messages and passes them all the way up to JBoss Cache, where they are then ignored.

          • 2. Re: JBossCache as a message oriented middleware?
            Bela Ban Master

            The cache was designed for 90% reads and 10% writes scenarios. If you use it the other way round, I do *not* recommend using JBossCache. If you want a notification bus, then rather use something like JMS or JGroups directly.
            If you only have 1 writer in the cluster though, your idea might work

            • 3. Re: JBossCache as a message oriented middleware?
              Zoltan Glozik Newbie

              Thanks a lot for both comments, very useful. There are going to be many writers and many readers in our application, so maybe better for us to go for a MoM.