Examples of BrokerService


Examples of org.apache.activemq.broker.BrokerService

        // on repeat store will be upgraded
        for (int repeats = 0; repeats < 3; repeats++) {
            KahaDBPersistenceAdapter kaha = new KahaDBPersistenceAdapter();
            kaha.setDirectory(testDir);
            kaha.setJournalMaxFileLength(1024 * 1024);
            BrokerService broker = createBroker(kaha);
            ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost");
            Connection connection = cf.createConnection();
            connection.setClientID("test");
            connection.start();
            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            Topic topic = session.createTopic("test.topic");
            Queue queue = session.createQueue("test.queue");

            if (repeats > 0) {
                // upgraded store will be empty so generated some more messages
                producerSomeMessages(connection, numToSend);
            }

            MessageConsumer queueConsumer = session.createConsumer(queue);
            int count = 0;
            for (int i = 0; i < (repeats == 0 ? 1000 : numToSend); i++) {
                TextMessage msg = (TextMessage) queueConsumer.receive(10000);
                count++;
                //System.err.println(msg.getText());
                assertNotNull(msg);
            }
            LOG.info("Consumed " + count + " from queue");
            count = 0;
            MessageConsumer topicConsumer = session.createDurableSubscriber(topic, "test");
            for (int i = 0; i < (repeats == 0 ? 1000 : numToSend); i++) {
                TextMessage msg = (TextMessage) topicConsumer.receive(10000);
                count++;
                //System.err.println(msg.getText());
                assertNotNull(msg);
            }
            LOG.info("Consumed " + count + " from topic");
            connection.close();
           
            broker.stop();
        }
    }
View Full Code Here

Examples of org.wso2.carbon.broker.core.BrokerService

                    omElementToSend =
                            CEPEventProcessor.getXMLElement(event, output.getElementMapping());
                }

                if (output.getBrokerName() != null) {
                    BrokerService brokerService = CEPServiceValueHolder.getInstance().getBrokerService();
                    BrokerConfigurationHelper brokerConfigurationHelper = new BrokerConfigurationHelper();
                    BrokerConfiguration brokerConfiguration =
                            brokerConfigurationHelper.getBrokerConfiguration(output.getBrokerName(), tenantId);
                    brokerService.publish(brokerConfiguration,
                            output.getTopic(),
                            omElementToSend);
                }
            }
        } catch (BrokerEventProcessingException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.