Wildfly JMS Clustering

171 views
Skip to first unread message

Thomas Mauch

unread,
Jul 24, 2023, 10:44:53 AM7/24/23
to WildFly
Hi

I'm looking for support in setting up a Wildfly configuration supporting active/passive configuration with JMS messaging.

I found the following example in your quickstarts which is the base for our attempts
https://github.com/wildfly/quickstart/tree/24.x/messaging-clustering-singleton.

Basically the application works fine, I can start both servers, one becomes active and is handle the generated messages.
If I kill the active server, the second server becomes active and is processing the newly generated messages.

I then modified the example so processing a message takes 5 seconds and that only one thread can process the messages in parallel,
so if I access /HelloWorldMDBServletClient, it takes 25 seconds until all messages have been processed by the active server.

I test now the following scenario:

1) Start-up server-1 (becomes active)
2) Start-up server-2 (becomes passive)
3) Generate JMS messages 1-5 by executing the HelloWorldMDBServletClient request
4) Server-1 starts processing the messages, taking 5 seconds for each
5) I kill server-1 after it has processed 1 message, so 4 are still remaining
6) I can see the console that server-2 now becomes active, however the 4 remaining messages are not processed by server-2
7) I generate a new bunch of JMS messages 6-10 by executing the HelloWorldMDBServletClient request, which are processed by server-2
8) I restart server-1 and now the 4 remaining messages are sent to server-2 and processed there

As consequence the messages are 2-5 are not processed until server-1 is restarted which is not acceptable.

I then tried
https://www.mastertheboss.com/jbossas/jboss-jms/jms-clustering-in-wildfly-and-jboss-eap/
but I was not able to make this work, as it seems that I cannot deploy to the passive server.

I also found several similar questions in the public forum, e.g.
https://groups.google.com/g/wildfly/c/qy-9xC6Llwc/m/Rx82cEf5BgAJ which links to https://developer.jboss.org/thread/274961
but no concrete advice how to implement it with a current version.

Question:
How to configure messaging correctly that queued messages are processed by another server if the old active server goes down
using the integrated ActiveMQ server (i.e. having just the 2 Wildfly servers).
Is there a working example?

Many Thanks!
Thomas

Emmanuel Hugonnet

unread,
Aug 8, 2023, 12:23:42 PM8/8/23
to Thomas Mauch, WildFly
Well it all depends on what you are trying to achieve :)
You should have a dedicated Artemis cluster or at least a dedicated WildFly cluster to ensure the broker clustering.
Could you be a little more explicit about your changes to ensure that it takes 5 seconds to process a message because the messages might
have been acked once they arrived at onMessage.

Emmanuel
> --
> You received this message because you are subscribed to the Google Groups "WildFly" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/wildfly/76700ccf-39a4-404f-b2a7-dbd8bc69b8c7n%40googlegroups.com
> <https://groups.google.com/d/msgid/wildfly/76700ccf-39a4-404f-b2a7-dbd8bc69b8c7n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Thomas Mauch

unread,
Aug 9, 2023, 5:29:20 AM8/9/23
to WildFly
What I try to achieve is to have a setup with an active/passive configuration where the passive server automatically takes over if the active server goes down.

My test should show that if server 1 is working on MDB messages but then dies, the unhandled messages are automatically processed by server 2.
So I did the following changes in both HelloWorldQueueMDB / HelloWorldTopicMDB:

- Add the following annotation to prevent parallel processing:
        @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1")

- Add sleeping time in onMessage() to simulate slow processing:
        Thread.currentThread().sleep(5_000);

As said I hoped that the messages are stored in the queue and the active server will consume them.
If the active server dies and the other server becomes active, it should then continue consuming the unprocessed messages.

Can you clarify what do you mean with "You should have a dedicated Artemis cluster or at least a dedicated WildFly cluster to ensure the broker clustering"?
As far as I understand the example,  it already sets up a Wildfly cluster. As Artemis seems to be integrated in Wildfly, I would have thought that this cluster is then also an Artemis cluster.
If this is not the case, what is the quickstart example then exactly demonstrating?

If another approach is needed to achieve what I'm looking for, can you point me to a corresponding example?

Many thanks,
Thomas

Emmanuel Hugonnet

unread,
Aug 9, 2023, 12:41:39 PM8/9/23
to wil...@googlegroups.com
In this example while the 2 brokers nodes are in a cluster, they are not in HA mode so I don't think it does what you want from messaging
point of view.
So I think you need to set up the broker to be in HA using either replication or shared-state:
You have tests for those 2 configs in testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/messaging/ha/ where we
configure this.

What I meant is that it is better to have a separation of concern:
 - a HA cluster for the application
 - a HA cluster for the broker

I've never tried to have the messaging-singleton quickstart with an artemis HA cluster. I 'll try to take a look at that to see if it would
work.

Emmanuel
> <https://groups.google.com/d/msgid/wildfly/76700ccf-39a4-404f-b2a7-dbd8bc69b8c7n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google Groups "WildFly" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/wildfly/81a23cd9-7fa2-4c33-aefe-591175087782n%40googlegroups.com
> <https://groups.google.com/d/msgid/wildfly/81a23cd9-7fa2-4c33-aefe-591175087782n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages