Search in sources :

Example 6 with MessageReceiver

use of org.apache.oozie.jms.MessageReceiver in project oozie by apache.

the class TestJMSAccessorService method testRegisterSingleConsumerPerTopic.

@Test
public void testRegisterSingleConsumerPerTopic() {
    try {
        HCatAccessorService hcatService = services.get(HCatAccessorService.class);
        JMSAccessorService jmsService = services.get(JMSAccessorService.class);
        String server = "hcat.server.com:5080";
        String topic = "hcat.mydb.mytable";
        JMSConnectionInfo connInfo = hcatService.getJMSConnectionInfo(new URI("hcat://hcat.server.com:8020"));
        jmsService.registerForNotification(connInfo, topic, new HCatMessageHandler(server));
        MessageReceiver receiver1 = jmsService.getMessageReceiver(connInfo, topic);
        jmsService.registerForNotification(connInfo, topic, new HCatMessageHandler(server));
        MessageReceiver receiver2 = jmsService.getMessageReceiver(connInfo, topic);
        assertEquals(receiver1, receiver2);
    } catch (Exception e) {
        e.printStackTrace();
        fail("Exception encountered : " + e);
    }
}
Also used : HCatMessageHandler(org.apache.oozie.dependency.hcat.HCatMessageHandler) MessageReceiver(org.apache.oozie.jms.MessageReceiver) JMSConnectionInfo(org.apache.oozie.jms.JMSConnectionInfo) URI(java.net.URI) Test(org.junit.Test)

Aggregations

MessageReceiver (org.apache.oozie.jms.MessageReceiver)6 URI (java.net.URI)2 HCatMessageHandler (org.apache.oozie.dependency.hcat.HCatMessageHandler)2 ConnectionContext (org.apache.oozie.jms.ConnectionContext)2 DefaultConnectionContext (org.apache.oozie.jms.DefaultConnectionContext)2 JMSConnectionInfo (org.apache.oozie.jms.JMSConnectionInfo)2 MessageHandler (org.apache.oozie.jms.MessageHandler)2 Test (org.junit.Test)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ArrayList (java.util.ArrayList)1 JMSException (javax.jms.JMSException)1 MessageConsumer (javax.jms.MessageConsumer)1 Session (javax.jms.Session)1