1
votes

I'm having troubles setting up a topic bridge in HornetQ (related to earlier question). The idea is this:

  • A notification gets posted to a topic on HornetQ server A
  • This notification gets sent to a topic on HornetQ server B over a core bridge
  • The client app gets the notification from server B.

The problem I'm having now is that if server B is down, the notification gets dropped. I would use a queue, but we need other subscribers. I was hoping the bridge would be durable, and messages would make it to the topic on server B. The way I have it set up is in the hornetq-configuration.xml:

<queues>
    <queue name="jms.topic.topic.dat.cds.internal">
        <address>jms.topic.topic.dat.cds.internal</address>
    </queue>
</queues>

<bridges>
    <bridge name="cds-bridge">
        <queue-name>jms.topic.topic.dat.cds.internal</queue-name>
        <forwarding-address>jms.topic.topic.dat.cds</forwarding-address>
        <reconnect-attempts>-1</reconnect-attempts>
        <use-duplicate-detection>true</use-duplicate-detection>
        <static-connectors>
            <connector-ref>remote-connector</connector-ref>
        </static-connectors>
    </bridge>
</bridges>

This works only if both servers are up.

Is there a way to make the bridge a durable subscriber? Is there something I'm missing?

[EDIT - solution] - This works. The trick is the topic names need to be the same.

<queues>
    <queue name="jms.topic.topic.dat.cds">
    <address>jms.topic.topic.dat.cds</address>
</queue>

<bridges>
<bridge name="cds-bridge">
    <queue-name>jms.topic.topic.dat.cds</queue-name>
    <forwarding-address>jms.topic.topic.dat.cds</forwarding-address>
    <reconnect-attempts>-1</reconnect-attempts>
    <use-duplicate-detection>true</use-duplicate-detection>
    <static-connectors>
        <connector-ref>remote-connector</connector-ref>
    </static-connectors>
</bridge>
</bridges>
1

1 Answers

0
votes

Say you have the topic jms.topic.SomeTopic

You could create the core-queue as this:

<queues>
    <queue name="SomeTopicBridge">
        <address>jms.topic.SomeTopic</address>
    </queue>
</queues>

Notice that the address on the Bridge Queue is the same as your Topic name.

Durable Subscriptions on HornetQ are just core-queues on the topic Address.

That way the message will be waiting to be activated until you restart your target server.

If that doesn't answer your question please provide me more detail and I will post edit this answer to address your question in a better way.

On your case, your address should been like this:

<queues>
    <queue name="cds-bridge-queue">
        <address>jms.topic.topic.dat.cds</address>
    </queue>
</queues>

With this, you will create a core-queue on the topic address, and this core queue will receive all the messages sent to the topic, even if the bridge is offline.