Package org.wso2.event

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


    }
   
   
    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

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

    }

    @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

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

        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

        }
        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

        }

        public void run() {
            try {
                MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                Event<MessageContext> event = new Event(msgCtx);
                subscriptions = subscriptionManager.getMatchingSubscriptions(event);
            } catch (EventException e) {
                handleException("Matching subscriptions fetching error", e);
            }
View Full Code Here

     * @throws EventException event
     */
    private void processGetStatusRequest(MessageContext mc,
                                         ResponseMessageBuilder messageBuilder)
            throws AxisFault, EventException {
        Subscription subscription =
                SubscriptionMessageBuilder.createGetStatusMessage(mc);
        if (log.isDebugEnabled()) {
            log.debug("GetStatus request recived for SynapseSubscription ID : " +
                    subscription.getId());
        }
        subscription = subscriptionManager.getSubscription(subscription.getId());
        if (subscription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending GetStatus responce for SynapseSubscription ID : " +
                        subscription.getId());
            }
            //send the responce
            SOAPEnvelope soapEnvelope = messageBuilder.genGetStatusResponse(subscription);
            dispatchResponse(soapEnvelope, EventingConstants.WSE_GET_STATUS_RESPONSE,
                    mc, false);
View Full Code Here


    public SynapseSubscription() {
        this.setId(UIDGenerator.generateURNString());
        this.setDeliveryMode(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
        SubscriptionData subscriptionData = new SubscriptionData();
        subscriptionData.setProperty(SynapseEventingConstants.STATIC_ENTRY, "false");
        this.setSubscriptionData(subscriptionData);
    }
View Full Code Here

TOP

Related Classes of org.wso2.event.EventBrokerService

Copyright © 2018 www.massapicom. 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.