Package org.wso2.carbon.event.core

Examples of org.wso2.carbon.event.core.EventBroker.subscribe()


            BrokerService brokerService = CEPServiceValueHolder.getInstance().getBrokerService();
            BrokerConfigurationHelper brokerConfigurationHelper = new BrokerConfigurationHelper();
            BrokerConfiguration brokerConfiguration =
                    brokerConfigurationHelper.getBrokerConfiguration(input.getBrokerName(), tenantId);
            try {
                brokerService.subscribe(brokerConfiguration, input.getTopic(),
                        brokerEventListener, axisConfiguration);
            } catch (BrokerEventProcessingException e) {
                String errorMessage = "Can not subscribe to the broker " + input.getBrokerName();
                log.error(errorMessage);
                throw new CEPConfigurationException(errorMessage, e);
View Full Code Here


        messageReceiver.start();
       
        BrokerClient brokerClient = new BrokerClient("http://127.0.0.1:9763/services/EventBrokerService");
        //brokerClient.subscribe(topic, messageReceiver.getListenerUrl());
       
        brokerClient.subscribe(topic, "http://parakum:6666/axis2/services/MessageCollector/receive/");
       
       
       
       
        OMFactory fac = OMAbstractFactory.getOMFactory();
View Full Code Here

           
            //subscribe, notice we set the message sink to listener
            String listenerUrl = messageReceiver.getListenerUrl();
            System.out.println("listining with "+ listenerUrl);
           
            String subscribtionId = brokerClient.subscribe(topic, listenerUrl);
           
          
            //String subscribtionId = brokerClient.subscribe(topic, "http://parakum:7777/axis2/services/MessageCollector/receive/");
            OMFactory fac = OMAbstractFactory.getOMFactory();
           
View Full Code Here

            throws BAMException {

        String subId = null;
        try {
            BrokerClient  client = BAMUtil.getBrokerClient(brokerURL, userName, password);
            subId = client.subscribe(topic, subscriberURL);
            log.info("Subscription to server:" + serverURL + " with subscriber URL: " + subscriberURL + " and topic:" + topic + " is successful..");

//        } catch (BrokerClientException e) {
//            throw new BAMException("Failed to subscribe : " +subscriberURL+ "to topic : " +topic ,e);
        } catch (Exception e) {
View Full Code Here

            Map<String, String> properties = brokerConfiguration.getProperties();
            BrokerClient brokerClient =
                    new BrokerClient(properties.get(BrokerConstants.BROKER_CONF_WS_PROP_URI),
                            properties.get(BrokerConstants.BROKER_CONF_WS_PROP_USERNAME),
                            properties.get(BrokerConstants.BROKER_CONF_WS_PROP_PASSWORD));
            brokerClient.subscribe(topicName, httpEpr);
           
        } catch (BrokerClientException e) {
            throw new BrokerEventProcessingException("Can not create the broker client", e);
        } catch (AuthenticationExceptionException e) {
            throw new BrokerEventProcessingException("Can not authenticate the broker client", e);
View Full Code Here

            subscription.setTopicName(UsageAgentConstants.BAM_SERVER_STAT_FILTER);
            subscription.setOwner(CarbonConstants.REGISTRY_SYSTEM_USERNAME);
            subscription.setEventDispatcherName(EventBrokerConstants.WS_EVENT_DISPATCHER_NAME);

            try {
                eventBrokerService.subscribe(subscription);
            } catch (EventBrokerException e) {
                String msg = "Cannot subscribe to the event broker ";
                log.error(msg);
                throw e;
            }
View Full Code Here

/*                    EventFilterDesc eventFilterDesc = new EventFilterDesc();
                    eventFilterDesc.setFilterValue("carbon/bam/data/publishers/mediation_stats");
                    subscription.setFilterDesc(eventFilterDesc);*/
                    try {
                        eventBroker.subscribe(subscription);
                    } catch (Exception e) {
                        throw new AxisFault("Can not subscribe to the event broker ", e);
                    }
                }
            }
View Full Code Here

                        SuperTenantCarbonContext.getCurrentContext().setTenantId(tenantId);
                        SuperTenantCarbonContext.getCurrentContext().getTenantDomain(true);
                        SuperTenantCarbonContext.getCurrentContext().setUsername(CarbonConstants.REGISTRY_SYSTEM_USERNAME);
                        SuperTenantCarbonContext.getCurrentContext().setUserRealm(realmService.getBootstrapRealm());

                        broker.subscribe(subscription);

                    } catch (EventBrokerException e) {
                        log.error("Can not publish the message ", e);
                    } finally {
                        SuperTenantCarbonContext.endTenantFlow();
View Full Code Here

            subscription.setTopicName(UsageAgentConstants.BAM_SERVER_STAT_FILTER);
            subscription.setOwner(CarbonConstants.REGISTRY_SYSTEM_USERNAME);
            subscription.setEventDispatcherName(EventBrokerConstants.WS_EVENT_DISPATCHER_NAME);

            try {
                eventBrokerService.subscribe(subscription);
            } catch (EventBrokerException e) {
                String msg = "Cannot subscribe to the event broker ";
                log.error(msg);
                throw e;
            }
View Full Code Here

            SuperTenantCarbonContext currentContext = SuperTenantCarbonContext.getCurrentContext();
            currentContext.setTenantId(registry.getCallerTenantId(), true);
            currentContext.setUserRealm(registry.getUserRealm());
            currentContext.setUsername(registry.getUserName());

            return eventingService.subscribe(subscription);
        } catch (InvalidMessageException e) {
            throw new DeploymentSynchronizerException("Error while subscribing for registry " +
                    "events on collection: " + absolutePath, e);
        } finally {
            SuperTenantCarbonContext.endTenantFlow();
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.