Examples of EventBrokerService


Examples of org.wso2.event.EventBrokerService

    /** Helper methods
     * @throws AxisFault **/
   
    public TopicNode getAllTopics() throws AxisFault{
        try {
            EventBrokerService broker = CarbonEventBroker.getInstance();
            return broker.getSubscriptionManager().getTopicTree();
        } catch (EventException e) {
            throw AxisFault.makeFault(e);
        }
    }
View Full Code Here

Examples of org.wso2.event.EventBrokerService

  public NonCarbonPubSubTest(String name) {
    super(name);
  }
 
  public void testBasicPubSub() throws Exception{
    EventBrokerService brokerInstance = CarbonEventBroker.getInstance();
    ((CarbonEventBroker)brokerInstance).registerSubscriptionManager(new InMemorySubscriptionManager());
    CarbonNotificationManager notifyManager = new CarbonNotificationManager();
    notifyManager.init(new HashMap<String, String>());
    ((CarbonEventBroker)brokerInstance).registerNotificationManager(notifyManager);
   
    Subscription subscription = new Subscription();
    String topic = "testTopic";
    subscription.setFilterDesc(new EventFilterDesc(null, topic));
   
   
   
    EventDispatcher dispatcher = new EventDispatcher<Object>() {
      public boolean onMatchingEvent(Event<Object> event,
          Subscription subscription) throws EventException {
        System.out.println("received "+event);
        return false;
      }
    };
   
    brokerInstance.subscribeNonPersistantly(subscription, dispatcher);
   
    brokerInstance.publishEvent(new Event(new Object(), topic));
   
    Thread.sleep(10000);
  }
View Full Code Here

Examples of org.wso2.event.EventBrokerService

    }
   
   
    public void updateTopic(TopicDetails topicDetails) throws AxisFault{
        try {
            EventBrokerService broker = CarbonEventBroker.getInstance();
            broker.getSubscriptionManager().updateTopic(topicDetails);
        } catch (EventException e) {
            throw AxisFault.makeFault(e);
        }
    }
View Full Code Here

Examples of org.wso2.event.EventBrokerService

        }
    }
   
    public TopicDetails getTopicDetails(String topicName) throws AxisFault{
        try {
            EventBrokerService broker = CarbonEventBroker.getInstance();
            return broker.getSubscriptionManager().getTopicDetails(topicName);
        } catch (EventException e) {
            throw AxisFault.makeFault(e);
        }
    }
View Full Code Here

Examples of org.wso2.event.EventBrokerService

    }

    @SuppressWarnings("unchecked")
    private void processConfiguration() {
        try {
            EventBrokerService service = null;
            OMElement configElement = getConfigElement();
            if(configElement == null){
                service = buildEventSource(null);
            }else{
                Iterator<OMElement> configIterator =
View Full Code Here

Examples of org.wso2.event.EventBrokerService

import org.wso2.event.NotificationManager;

public class CarbonEventBrokerTest extends TestCase {

    public void testGetDefaultInstance() throws Exception {
        EventBrokerService broker1 = CarbonEventBroker.getInstance();
        EventBrokerService broker2 = CarbonEventBroker.getInstance();

        assertSame("The instance is not unique", broker1,  broker2);
    }
View Full Code Here

Examples of org.wso2.event.EventBrokerService

        assertSame("The instance is not unique", broker1,  broker2);
    }

    public void testGetNamedInstance() throws Exception {
        EventBrokerService broker1 = CarbonEventBroker.getInstance("instance1");
        EventBrokerService broker2 = CarbonEventBroker.getInstance("instance1");

        assertSame("The instance is not unique", broker1,  broker2);

        EventBrokerService broker3 = CarbonEventBroker.getInstance();
        EventBrokerService broker4 = CarbonEventBroker.getInstance("instance2");

        assertNotSame("The instance is not unique", broker1,  broker3);
        assertNotSame("The instance is not unique", broker1,  broker4);
    }
View Full Code Here

Examples of org.wso2.event.EventBrokerService

        }
        return mc;
    }
    public static boolean isSecureTopic(String topicName)throws AxisFault{
        try {
            EventBrokerService broker = CarbonEventBroker.getInstance();
            return broker.getSubscriptionManager().isSecureTopic(topicName);
        } catch (EventException e) {
            throw AxisFault.makeFault(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.