This is on XP SP2, using recent build (r921371 + my QPID-2519 patch
applied but not being used.)

I think I'm doing this correctly, but I never see anything from the
receiver on the second broker.  As I understand it, shouldn't clients
be able to subscribe to topics and see published messages no matter
which broker they are connected to?

My end goal here is to add some fault tolerance to a Windows AMQP QPID
system, where clients can switch to another broker if their current
broker dies.  Since someone chose a Linux only solution for
clustering, I think my simplest option is to leverage Federation, with
something like ResilientConnection to manage a list of brokers, and
fail client connections over to other brokers on connection failure.
This is from my federation test case, and I'm probably setting
something up incorrectly...

Greatly appreciate the help!

Kerry Bonin



I bring up two brokers:
  start "5680" /Dd:\dev\qpid-r921371\cpp\build\src\debug qpidd.exe
--data-dir=.\qpidd.data.5680 --auth=no --port=5680
--load-module=qmfconsoled.dll
  start "5681" /Dd:\dev\qpid-r921371\cpp\build\src\debug qpidd.exe
--data-dir=.\qpidd.data.5681 --auth=no --port=5681
--load-module=qmfconsoled.dll

Create exchanges
  python D:\dev\qpid-r921371\tools\src\py\qpid-config -a
localhost:5680 add exchange topic fed.topic
  python D:\dev\qpid-r921371\tools\src\py\qpid-config -a
localhost:5681 add exchange topic fed.topic

Create routes
  python D:\dev\qpid-r921371\tools\src\py\qpid-route dynamic add
localhost:5680 localhost:5681 fed.topic
  python D:\dev\qpid-r921371\tools\src\py\qpid-route dynamic add
localhost:5681 localhost:5680 fed.topic

This appears to work correctly :
  D:\dev\qpid\bin>python d:\dev\qpid-r921371\tools\src\py\qpid-route
route map localhost:5680

  Finding Linked Brokers:
      localhost:5680... Ok
      localhost:5681... Ok

  Dynamic Routes:

    Exchange fed.topic:
      localhost:5681 <=> localhost:5680

  Static Routes:
    none found


Now trimmed from my C++ testbed...

// Setup URLs and Addresses

std::string urlA = "amqp:tcp:127.0.0.1:5680";
std::string urlB = "amqp:tcp:127.0.0.1:5681";
std::string queue = "fed.topic";
Address addressTx( queue );
Address addressRx( queue );
int64_t timeout = 1000;

// Setup transmitter on 5680

Connection connectionTxA;
connectionTxA.open( urlA );
Session sessionTxA = connectionTxA.newSession();
Sender senderTxA = sessionTxA.createSender( addressTx );

// Setup listeners on 5680 and 5681

Connection connectionRxA;
connectionRxA.open( urlA );
Session sessionRxA = connectionRxA.newSession();
Receiver receiverRxA = sessionRxA.createReceiver( addressRx );

Connection connectionRxB;
connectionRxB.open( urlB );
Session sessionRxB = connectionRxB.newSession();
Receiver receiverRxB = sessionRxB.createReceiver( addressRx );

// Transmit to 5680

Message messageOut;
MapContent contentOut( messageOut );
contentOut["id"] = 1234;
contentOut["name"] = "Request";
contentOut.encode();
senderTxA.send( messageOut );

// Local listener sees the message

Message messageRxA;
if( receiverRxA.fetch( messageRxA, qpid::sys::Duration( timeout ) ) )
{
        MapView contentRxA( messageRxA );
        std::cout << "  local received: " << contentRxA << std::endl;
        sessionRxA.acknowledge();
}
else
        std::cout << "  local timeout " << std::endl;

// Remote never does...

Message messageRxB;
if( receiverRxB.fetch( messageRxB, qpid::sys::Duration( timeout ) ) )
{
        MapView contentRxB( messageRxB );
        std::cout << "  remote received: " << contentRxB << std::endl;
        sessionRxB.acknowledge();
}
else
        std::cout << "  remote timeout " << std::endl;

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscr...@qpid.apache.org

Reply via email to