Package org.wso2.carbon.event.core

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


                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


     * @param serverName  the serverName to publish
     * @throws CSGException throws in case of an error
     */
    public void publishService(String serviceName, String serverName) throws CSGException {
        CSGServicePublisher servicePublisher = new CSGAgentConfigLayer().getCSGServicePublisher();
        if (servicePublisher.publish(serviceName, serverName)) {
            log.info("The service '" + serviceName + "', published sucessfully");
        } else {
            handleException("Cloud not publish the service");
        }
    }
View Full Code Here

       
       
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMElement ele = fac.createOMElement(new QName("http://wso2.org","foo"));
        ele.setText("hello");
        brokerClient.publish(topic, ele);
       
        Thread.sleep(3000);

    }
View Full Code Here

            OMFactory fac = OMAbstractFactory.getOMFactory();
           
            for(int i = 0;i<2;i++){
                OMElement ele = fac.createOMElement(new QName("http://wso2.org","foo"+i));
                ele.setText("hello"+i);
                brokerClient.publish(topic+"/bar", ele);
            }
           
            for(int i = 0;i<2;i++){
                OMElement ele = fac.createOMElement(new QName("http://wso2.org","foo"+i));
                ele.setText("Should not receive"+i);
View Full Code Here

            }
           
            for(int i = 0;i<2;i++){
                OMElement ele = fac.createOMElement(new QName("http://wso2.org","foo"+i));
                ele.setText("Should not receive"+i);
                brokerClient.publish("/bar", ele);
            }
           
           
            brokerClient.unsubscribe(subscribtionId);
           
View Full Code Here

    OMFactory fac = OMAbstractFactory.getOMFactory();
   
    for(int i = 0;i<2;i++){
        OMElement ele = fac.createOMElement(new QName("http://wso2.org","foo"+i));
        ele.setText("hello"+i);
        brokerClient.publish(topic+"/bar", ele);
    }
//   
//    brokerClient.unsubscribe(subscribtionId);
//    brokerClient.deleteSecureTopic(topic);
//   
View Full Code Here

            BrokerClient brokerClient =
                    new BrokerClient(configurationContextService.getClientConfigContext(),
                                     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.publish(topicName, message);
        } catch (AuthenticationExceptionException e) {
            throw new BrokerEventProcessingException("Can not authenticate the broker client", e);
        } catch (AxisFault axisFault) {
            throw new BrokerEventProcessingException("Can not subscribe", axisFault);
        }
View Full Code Here

                SuperTenantCarbonContext.startTenantFlow();
                int tenantId = SuperTenantCarbonContext.getCurrentContext(PublisherUtils.getConfigurationContext()).getTenantId();
                SuperTenantCarbonContext.getCurrentContext().setTenantId(tenantId);
                SuperTenantCarbonContext.getCurrentContext().getTenantDomain(true);

                eb.publish(message, ActivityPublisherConstants.BAM_REG_PATH);

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

            SuperTenantCarbonContext.startTenantFlow();
            int tenantId = SuperTenantCarbonContext.getCurrentContext(ActivityPublisherUtils.getConfigurationContextService().getServerConfigContext()).getTenantId();
            SuperTenantCarbonContext.getCurrentContext().setTenantId(tenantId);
            SuperTenantCarbonContext.getCurrentContext().getTenantDomain(true);

            eb.publish(message, ActivityPublisherConstants.BAM_REG_PATH);

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

        // publish the event
        try {
            SuperTenantCarbonContext.startTenantFlow();
            SuperTenantCarbonContext.getCurrentContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID);
            SuperTenantCarbonContext.getCurrentContext().getTenantDomain(true);
            eventBrokerService.publish(message, topic);
        } catch (EventBrokerException e) {
            log.error("SystemStatisticsHandler - Unable to send notification for stat threshold", 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.