org.wso2.carbon.databridge.agent.thrift.internal.publisher.client
Class EventPublisher

java.lang.Object
  extended by org.wso2.carbon.databridge.agent.thrift.internal.publisher.client.EventPublisher
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
ThriftEventPublisher

public abstract class EventPublisher
extends Object
implements Runnable

The publisher who sends all the arrived events to the Agent Server using a pool of threads


Constructor Summary
EventPublisher(EventQueue<org.wso2.carbon.databridge.commons.Event> eventQueue, org.apache.commons.pool.impl.GenericKeyedObjectPool transportPool, Semaphore queueSemaphore, int maxMessageBundleSize, DataPublisherConfiguration dataPublisherConfiguration, AgentAuthenticator agentAuthenticator, ThreadPoolExecutor threadPool)
           
 
Method Summary
 void attemptReconnection(int reconnectionTime, String sessionId)
           
protected abstract  org.wso2.carbon.databridge.commons.thrift.data.ThriftEventBundle convertToEventBundle(Object eventBundle, org.wso2.carbon.databridge.commons.Event event, String sessionId)
           
protected abstract  String defineStream(Object client, String currentSessionId, String streamDefinition)
           
 String defineStream(String sessionId, String streamDefinition)
           
protected abstract  boolean deleteStream(Object client, String currentSessionId, String streamId)
           
protected abstract  boolean deleteStream(Object client, String currentSessionId, String streamName, String streamVersion)
           
 boolean deleteStream(String sessionId, String streamId)
           
 boolean deleteStream(String sessionId, String streamName, String streamVersion)
           
protected abstract  String findStreamId(Object client, String currentSessionId, String name, String version)
           
 String findStreamId(String sessionId, String name, String version)
           
protected abstract  int getNumberOfEvents(Object eventBundle)
           
protected abstract  String getSessionId(Object eventBundle)
           
 void registerReceiverStateObserver(ReceiverStateObserver stateObserver)
           
 void run()
           
protected abstract  void setSessionId(Object eventBundle, String reconnect)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventPublisher

public EventPublisher(EventQueue<org.wso2.carbon.databridge.commons.Event> eventQueue,
                      org.apache.commons.pool.impl.GenericKeyedObjectPool transportPool,
                      Semaphore queueSemaphore,
                      int maxMessageBundleSize,
                      DataPublisherConfiguration dataPublisherConfiguration,
                      AgentAuthenticator agentAuthenticator,
                      ThreadPoolExecutor threadPool)
Method Detail

registerReceiverStateObserver

public void registerReceiverStateObserver(ReceiverStateObserver stateObserver)

run

public void run()
Specified by:
run in interface Runnable

getNumberOfEvents

protected abstract int getNumberOfEvents(Object eventBundle)

convertToEventBundle

protected abstract org.wso2.carbon.databridge.commons.thrift.data.ThriftEventBundle convertToEventBundle(Object eventBundle,
                                                                                                         org.wso2.carbon.databridge.commons.Event event,
                                                                                                         String sessionId)

setSessionId

protected abstract void setSessionId(Object eventBundle,
                                     String reconnect)

getSessionId

protected abstract String getSessionId(Object eventBundle)

defineStream

public String defineStream(String sessionId,
                           String streamDefinition)
                    throws AgentException,
                           org.wso2.carbon.databridge.commons.exception.DifferentStreamDefinitionAlreadyDefinedException,
                           org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException,
                           org.wso2.carbon.databridge.commons.exception.StreamDefinitionException
Throws:
AgentException
org.wso2.carbon.databridge.commons.exception.DifferentStreamDefinitionAlreadyDefinedException
org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException
org.wso2.carbon.databridge.commons.exception.StreamDefinitionException

defineStream

protected abstract String defineStream(Object client,
                                       String currentSessionId,
                                       String streamDefinition)
                                throws org.wso2.carbon.databridge.commons.exception.DifferentStreamDefinitionAlreadyDefinedException,
                                       org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException,
                                       EventPublisherException,
                                       org.wso2.carbon.databridge.commons.exception.SessionTimeoutException,
                                       org.wso2.carbon.databridge.commons.exception.StreamDefinitionException
Throws:
org.wso2.carbon.databridge.commons.exception.DifferentStreamDefinitionAlreadyDefinedException
org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException
EventPublisherException
org.wso2.carbon.databridge.commons.exception.SessionTimeoutException
org.wso2.carbon.databridge.commons.exception.StreamDefinitionException

findStreamId

public String findStreamId(String sessionId,
                           String name,
                           String version)
                    throws AgentException
Throws:
AgentException

findStreamId

protected abstract String findStreamId(Object client,
                                       String currentSessionId,
                                       String name,
                                       String version)
                                throws org.wso2.carbon.databridge.commons.exception.SessionTimeoutException,
                                       EventPublisherException
Throws:
org.wso2.carbon.databridge.commons.exception.SessionTimeoutException
EventPublisherException

deleteStream

public boolean deleteStream(String sessionId,
                            String streamId)
                     throws AgentException
Throws:
AgentException

deleteStream

protected abstract boolean deleteStream(Object client,
                                        String currentSessionId,
                                        String streamId)
                                 throws EventPublisherException,
                                        org.wso2.carbon.databridge.commons.exception.SessionTimeoutException
Throws:
EventPublisherException
org.wso2.carbon.databridge.commons.exception.SessionTimeoutException

deleteStream

public boolean deleteStream(String sessionId,
                            String streamName,
                            String streamVersion)
                     throws AgentException
Throws:
AgentException

deleteStream

protected abstract boolean deleteStream(Object client,
                                        String currentSessionId,
                                        String streamName,
                                        String streamVersion)
                                 throws EventPublisherException,
                                        org.wso2.carbon.databridge.commons.exception.SessionTimeoutException
Throws:
EventPublisherException
org.wso2.carbon.databridge.commons.exception.SessionTimeoutException

attemptReconnection

public void attemptReconnection(int reconnectionTime,
                                String sessionId)


Copyright © 2015 WSO2. All rights reserved.