Connector for connecting ActiveMQ to WebSphereMQ without using XML configuration

I want to create a broker for the interaction between ActiveMQ and WebSphere MQ in an embedded broker. I know that there is a network connector in activemq for this (broker-broker), but I do not know how to configure it to connect to WebSphere MQ. While searching on the Internet, I found several different ways to configure XML, and I noticed that the XML tags used are not related to the network connector, but are referenced <jmsBridgeConnectors>, so I am doing research on this bridge connector using java but I could not find something, which tells me how to do this.

Is there an explicit way to configure the bridge connector in ActiveMQ for WebSphere MQ for the embedded broker using Java code instead of using the XML configuration?

I know that this is possible using the XML configuration, but what if I implement a built-in broker (as I mentioned earlier) and I want to configure the broker instance using the bridge connector in WebSphere MQ with Java code, Does ActiveMQ provide a class or interface API for this?

This is what I did to connect the two activemq intermediaries

try {
        getBroker().addConnector("tcp://localhost:61616");
        getBroker().addNetworkConnector("static:(tcp://remotBroker:61616)");
    } catch (Exception e) {
        logger.error("Unexpected ERROR, connection lost.");
        e.printStackTrace();
    }

One transport connector for listening on port 61616 and one network connector for establishing a connection with my local broker on a remote broker, both brokers are examples of activemq. Now I want to connect from my local ActiveMQ broker to the WebSphere MQ broker using java code, without XML.

+4
source share
1 answer

. ActiveMQ QUEUE42 WebSphere MQ. .

, WMQ- : com.ibm.mq.jar com.ibm.mqjms.jar( ). , JMSQueueConnector QueueConnectionFactory ( WMQ) / , . - , .

    BrokerService broker = new BrokerService();
    broker.setBrokerName("amqbroker");
    broker.setPersistent(false);
    broker.setTransportConnectorURIs(new String[] {"tcp://localhost:61616"});

    // setup bridge
    JmsQueueConnector qCon = new JmsQueueConnector();

    JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);
    JmsQueueConnectionFactory cf = ff.createQueueConnectionFactory();
    cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, "192.168.13.151");
    cf.setIntProperty(WMQConstants.WMQ_PORT, 1414);
    cf.setStringProperty(WMQConstants.WMQ_CHANNEL, "SYSTEM.DEF.SVRCONN");
    cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
    cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, "SUPERHERO");

    qCon.setOutboundQueueConnectionFactory(cf);
    OutboundQueueBridge outBridge1 = new OutboundQueueBridge("QUEUE42");
    qCon.setOutboundQueueBridges(new OutboundQueueBridge[] {outBridge1});
    broker.setJmsBridgeConnectors(new JmsConnector[] {qCon});
    broker.start();
+3

All Articles