Examples of BrokerClient


Examples of org.codehaus.activemq.broker.BrokerClient

    /**
     * @param channel - client to remove
     */
    public void removeClient(TransportChannel channel) {
        BrokerClient client = (BrokerClient) clients.remove(channel);
        if (client != null) {
            if (log.isDebugEnabled()) {
                log.debug("Client leaving client: " + client);
            }

            // we may have already been closed, if not then lets simulate a normal shutdown
            client.cleanUp();
        }
        else {
            // might have got a duplicate callback
            log.warn("No such client for channel: " + channel);
        }
View Full Code Here

Examples of org.wso2.carbon.event.client.broker.BrokerClient

        //backendServerURL = backendServerURL.replaceAll("9443", "9763");
        backendServerURL = backendServerURL + "EventBrokerService";
       
        //String backendServerURL = CarbonUIUtil.getServerURL(request.get, session);
        String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
        return new BrokerClient(backendServerURL,cookie);
    }
View Full Code Here

Examples of org.wso2.carbon.event.client.broker.BrokerClient

        String confFile = repoLocation + "/conf/axis2_client.xml";
       
        SimpleMessageReceiver messageReceiver = new SimpleMessageReceiver(repoLocation, confFile,null);
        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();
        OMElement ele = fac.createOMElement(new QName("http://wso2.org","foo"));
        ele.setText("hello");
        brokerClient.publish(topic, ele);
       
        Thread.sleep(3000);

    }
View Full Code Here

Examples of org.wso2.carbon.event.client.broker.BrokerClient

            });
            messageReceiver.start();
           
            //Initialize the broker
            //BrokerClient brokerClient = new BrokerClient("http://127.0.0.1:9763/services/EventBrokerService");
            BrokerClient brokerClient = new BrokerClient("https://127.0.0.1:9443/services/EventBrokerService", "admin", "admin");
           
            //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();
           
            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);
                brokerClient.publish("/bar", ele);
            }
           
           
            brokerClient.unsubscribe(subscribtionId);
           
            Thread.sleep(3000);
//       
//        BrokerClient brokerClient = new BrokerClient("http://127.0.0.1:5555/services/EventBrokerService");
//        SubscriptionDetails[] details = brokerClient.getAllSubscriptions();
View Full Code Here

Examples of org.wso2.carbon.event.client.broker.BrokerClient

    });
    messageReceiver.start();
   
    //Initialize the broker
    //BrokerClient brokerClient = new BrokerClient("http://127.0.0.1:9763/services/EventBrokerService");
    BrokerClient brokerClient = new BrokerClient("https://127.0.0.1:9443/services/EventBrokerService", "admin", "admin");
   
   
    //https://127.0.0.1:9443/services/BrokerSecurityManager
   
   
//    brokerClient.createSecureTopic(topic, null, null);
//    brokerClient.createSecureTopic(topic+"/bar", null, null);
//    brokerClient.shareATopic(topic, null, new String[]{"everyone"});
//   
//    brokerClient = new BrokerClient("https://127.0.0.1:9443/services/EventBrokerService", "test", "test1234");
//   
//    //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();
   
    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);
//   
//    Thread.sleep(3000);
    SubscriptionDetails[] allSubscriptions = brokerClient.getAllSubscriptions();
    for(SubscriptionDetails details:allSubscriptions){
        System.out.println(new Date(details.getCreatedTime().getTimeInMillis()));
    }

}
View Full Code Here

Examples of org.wso2.carbon.event.client.broker.BrokerClient

        return serversListCache;
    }

    public static BrokerClient getBrokerClient(String brokerURL, String userName, String password)
            throws Exception {
        return new BrokerClient(BAMUtil.getConfigurationContextService().getServerConfigContext(),
                    brokerURL, userName, password);
    }
View Full Code Here

Examples of org.wso2.carbon.event.client.broker.BrokerClient

                    brokerURL, userName, password);
    }

    public static BrokerClient getBrokerClient(String brokerURL, String cookie)
            throws Exception {
        return new BrokerClient(BAMUtil.getConfigurationContextService().getServerConfigContext(),
                    brokerURL, cookie);
    }
View Full Code Here

Examples of org.wso2.carbon.event.client.broker.BrokerClient

    public static String subscribe(String topic, String brokerURL, String subscriberURL, String serverURL, String userName, String password)
            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

Examples of org.wso2.carbon.event.client.broker.BrokerClient

    public static void unsubscribe(String brokerURL, String identifier, String serverType, String serverURL) throws BAMException {
        ServerDO monitoredServer = null;
        try {
            monitoredServer = persistenceManager.getMonitoredServer(serverURL);

            BrokerClient client = new BrokerClient(BAMUtil.getConfigurationContextService().getServerConfigContext(),
                                                   brokerURL, monitoredServer.getUserName(), monitoredServer.getPassword());
            client.unsubscribe(identifier);
        } catch (RemoteException e) {


        } catch (Exception e) {
            try {
View Full Code Here

Examples of org.wso2.carbon.event.client.broker.BrokerClient

            }

            httpEpr += topicName;

            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
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.