org.wso2.carbon.databridge.agent.thrift
Class DataPublisher

java.lang.Object
  extended by org.wso2.carbon.databridge.agent.thrift.DataPublisher

public class DataPublisher
extends Object

Publisher will maintain a single connection to a server, and define/find event streams and send events.


Constructor Summary
DataPublisher(String receiverUrl, String userName, String password)
          To create the Data Publisher and the respective agent to publish events For TCP protocol For secure data transfer the Authenticator URL will be the same as the Receiver URL and for normal data transfer the Authenticator ip will be the same as receiver ip but its port will be 100+ for tcp For HTTP protocol For secure data transfer the Authenticator URL will be the same as the Receiver URL and normal data transfer NOT supported via this constructor
DataPublisher(String receiverUrl, String userName, String password, Agent agent)
          To create the Data Publisher to publish events For TCP protocol For secure data transfer the Authenticator URL will be the same as the Receiver URL and for normal data transfer the Authenticator ip will be the same as receiver ip but its port will be 100+ for tcp For HTTP protocol For secure data transfer the Authenticator URL will be the same as the Receiver URL and normal data transfer NOT supported via this constructor
DataPublisher(String authenticationUrl, String receiverUrl, String userName, String password)
          To create the Data Publisher and the respective agent to publish events
DataPublisher(String authenticationUrl, String receiverUrl, String userName, String password, Agent agent)
          To create the Data Publisher and the respective agent to publish events
 
Method Summary
 String defineStream(org.wso2.carbon.databridge.commons.StreamDefinition streamDefinition)
          Defining stream on which events will be published by this DataPublisher
 String defineStream(String streamDefinition)
          Defining stream on which events will be published by this DataPublisher
 boolean deleteStream(String streamId)
          Defining stream on which events will be published by this DataPublisher
 boolean deleteStream(String streamName, String streamVersion)
          Defining stream on which events will be published by this DataPublisher
 String findStream(String name, String version)
          Deprecated. 
 String findStreamId(String name, String version)
          Finding already existing stream's Id to publish data
 Agent getAgent()
          to get the underlining agent
 void publish(org.wso2.carbon.databridge.commons.Event event)
          Publishing the events to the server
 void publish(String streamId, long timeStamp, Object[] metaDataArray, Object[] correlationDataArray, Object[] payloadDataArray)
          Publishing events to the server
 void publish(String streamId, long timeStamp, Object[] metaDataArray, Object[] correlationDataArray, Object[] payloadDataArray, Map<String,String> arbitraryDataMap)
          Publishing events to the server
 void publish(String streamId, Object[] metaDataArray, Object[] correlationDataArray, Object[] payloadDataArray)
          Publishing events to the server
 void publish(String streamId, Object[] metaDataArray, Object[] correlationDataArray, Object[] payloadDataArray, Map<String,String> arbitraryDataMap)
          Publishing events to the server
 void registerReceiverStateObserver(ReceiverStateObserver stateObserver)
           
 void setAgent(Agent agent)
          to set the underlining agent which could be sheared by many data publishers
 void stop()
          Disconnecting from the server
 void stopNow()
          Disconnecting from the server
 boolean tryPublish(org.wso2.carbon.databridge.commons.Event event)
           
 boolean tryPublish(String streamId, long timestamp, Object[] metaDataArray, Object[] correlationDataArray, Object[] payloadDataArray, Map<String,String> arbitraryDataMap)
           
 boolean tryPublish(String streamId, Object[] metaDataArray, Object[] correlationDataArray, Object[] payloadDataArray, Map<String,String> arbitraryDataMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataPublisher

public DataPublisher(String receiverUrl,
                     String userName,
                     String password)
              throws MalformedURLException,
                     AgentException,
                     org.wso2.carbon.databridge.commons.exception.AuthenticationException,
                     org.wso2.carbon.databridge.commons.exception.TransportException
To create the Data Publisher and the respective agent to publish events For TCP protocol For secure data transfer the Authenticator URL will be the same as the Receiver URL and for normal data transfer the Authenticator ip will be the same as receiver ip but its port will be 100+ for tcp For HTTP protocol For secure data transfer the Authenticator URL will be the same as the Receiver URL and normal data transfer NOT supported via this constructor

Parameters:
receiverUrl - the event receiver url use ://: for normal data transfer and use ://: for secure data transfer
userName - user name
password - password
Throws:
MalformedURLException
AgentException
org.wso2.carbon.databridge.commons.exception.AuthenticationException
org.wso2.carbon.databridge.commons.exception.TransportException

DataPublisher

public DataPublisher(String authenticationUrl,
                     String receiverUrl,
                     String userName,
                     String password)
              throws MalformedURLException,
                     AgentException,
                     org.wso2.carbon.databridge.commons.exception.AuthenticationException,
                     org.wso2.carbon.databridge.commons.exception.TransportException
To create the Data Publisher and the respective agent to publish events

Parameters:
authenticationUrl - the secure authentication url, use ://:
receiverUrl - the event receiver url use ://: for normal data transfer and use ://: for secure data transfer
userName - user name
password - password
Throws:
MalformedURLException
AgentException
org.wso2.carbon.databridge.commons.exception.AuthenticationException
org.wso2.carbon.databridge.commons.exception.TransportException

DataPublisher

public DataPublisher(String receiverUrl,
                     String userName,
                     String password,
                     Agent agent)
              throws MalformedURLException,
                     AgentException,
                     org.wso2.carbon.databridge.commons.exception.AuthenticationException,
                     org.wso2.carbon.databridge.commons.exception.TransportException
To create the Data Publisher to publish events For TCP protocol For secure data transfer the Authenticator URL will be the same as the Receiver URL and for normal data transfer the Authenticator ip will be the same as receiver ip but its port will be 100+ for tcp For HTTP protocol For secure data transfer the Authenticator URL will be the same as the Receiver URL and normal data transfer NOT supported via this constructor

Parameters:
receiverUrl - the event receiver url use ://: for normal data transfer and use ://: for secure data transfer
userName - user name
password - password
agent - the underlining agent
Throws:
MalformedURLException
AgentException
org.wso2.carbon.databridge.commons.exception.AuthenticationException
org.wso2.carbon.databridge.commons.exception.TransportException

DataPublisher

public DataPublisher(String authenticationUrl,
                     String receiverUrl,
                     String userName,
                     String password,
                     Agent agent)
              throws MalformedURLException,
                     AgentException,
                     org.wso2.carbon.databridge.commons.exception.AuthenticationException,
                     org.wso2.carbon.databridge.commons.exception.TransportException
To create the Data Publisher and the respective agent to publish events

Parameters:
authenticationUrl - the secure authentication url, use ://:
receiverUrl - the event receiver url use ://: for normal data transfer and use ://: for secure data transfer
userName - user name
password - password
agent - the underlining agent
Throws:
MalformedURLException
AgentException
org.wso2.carbon.databridge.commons.exception.AuthenticationException
org.wso2.carbon.databridge.commons.exception.TransportException
Method Detail

setAgent

public void setAgent(Agent agent)
              throws AgentException,
                     org.wso2.carbon.databridge.commons.exception.AuthenticationException,
                     org.wso2.carbon.databridge.commons.exception.TransportException
to set the underlining agent which could be sheared by many data publishers

Parameters:
agent - the underlining agent
Throws:
AgentException
org.wso2.carbon.databridge.commons.exception.AuthenticationException
org.wso2.carbon.databridge.commons.exception.TransportException

getAgent

public Agent getAgent()
to get the underlining agent

Returns:
agent

registerReceiverStateObserver

public void registerReceiverStateObserver(ReceiverStateObserver stateObserver)

defineStream

public String defineStream(String streamDefinition)
                    throws AgentException,
                           org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException,
                           org.wso2.carbon.databridge.commons.exception.StreamDefinitionException,
                           org.wso2.carbon.databridge.commons.exception.DifferentStreamDefinitionAlreadyDefinedException
Defining stream on which events will be published by this DataPublisher

Parameters:
streamDefinition - on json format
Returns:
the stream id
Throws:
AgentException
org.wso2.carbon.databridge.commons.exception.DifferentStreamDefinitionAlreadyDefinedException
org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException
org.wso2.carbon.databridge.commons.exception.StreamDefinitionException

defineStream

public String defineStream(org.wso2.carbon.databridge.commons.StreamDefinition streamDefinition)
                    throws AgentException,
                           org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException,
                           org.wso2.carbon.databridge.commons.exception.StreamDefinitionException,
                           org.wso2.carbon.databridge.commons.exception.DifferentStreamDefinitionAlreadyDefinedException
Defining stream on which events will be published by this DataPublisher

Parameters:
streamDefinition - on json format
Returns:
the stream id
Throws:
AgentException
org.wso2.carbon.databridge.commons.exception.DifferentStreamDefinitionAlreadyDefinedException
org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException
org.wso2.carbon.databridge.commons.exception.StreamDefinitionException

findStream

@Deprecated
public String findStream(String name,
                                    String version)
                  throws AgentException,
                         org.wso2.carbon.databridge.commons.exception.StreamDefinitionException,
                         org.wso2.carbon.databridge.commons.exception.NoStreamDefinitionExistException
Deprecated. 

Finding already existing stream's Id to publish data

Parameters:
name - the stream name
version - the version of the stream
Returns:
stream id
Throws:
AgentException - if client cannot publish the type definition
org.wso2.carbon.databridge.commons.exception.StreamDefinitionException
org.wso2.carbon.databridge.commons.exception.NoStreamDefinitionExistException

findStreamId

public String findStreamId(String name,
                           String version)
                    throws AgentException
Finding already existing stream's Id to publish data

Parameters:
name - the stream name
version - the version of the stream
Returns:
stream id
Throws:
AgentException - if client cannot publish the type definition

deleteStream

public boolean deleteStream(String streamId)
                     throws AgentException
Defining stream on which events will be published by this DataPublisher

Parameters:
streamId - of the Stream
Returns:
the stream id
Throws:
AgentException
org.wso2.carbon.databridge.commons.exception.DifferentStreamDefinitionAlreadyDefinedException
org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException
org.wso2.carbon.databridge.commons.exception.StreamDefinitionException

deleteStream

public boolean deleteStream(String streamName,
                            String streamVersion)
                     throws AgentException
Defining stream on which events will be published by this DataPublisher

Parameters:
streamName - of the Stream
streamVersion - of the Stream
Returns:
the stream id
Throws:
AgentException
org.wso2.carbon.databridge.commons.exception.DifferentStreamDefinitionAlreadyDefinedException
org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException
org.wso2.carbon.databridge.commons.exception.StreamDefinitionException

publish

public void publish(org.wso2.carbon.databridge.commons.Event event)
             throws AgentException
Publishing the events to the server

Parameters:
event - the event to be published
Throws:
AgentException - if client cannot publish the event

tryPublish

public boolean tryPublish(org.wso2.carbon.databridge.commons.Event event)
                   throws AgentException
Throws:
AgentException

publish

public void publish(String streamId,
                    Object[] metaDataArray,
                    Object[] correlationDataArray,
                    Object[] payloadDataArray)
             throws AgentException
Publishing events to the server

Parameters:
streamId - of the stream on which the events are published
metaDataArray - metadata array of the event
correlationDataArray - correlation data array of the event
payloadDataArray - payload data array of the event
Throws:
AgentException

tryPublish

public boolean tryPublish(String streamId,
                          Object[] metaDataArray,
                          Object[] correlationDataArray,
                          Object[] payloadDataArray,
                          Map<String,String> arbitraryDataMap)
                   throws AgentException
Throws:
AgentException

tryPublish

public boolean tryPublish(String streamId,
                          long timestamp,
                          Object[] metaDataArray,
                          Object[] correlationDataArray,
                          Object[] payloadDataArray,
                          Map<String,String> arbitraryDataMap)
                   throws AgentException
Throws:
AgentException

publish

public void publish(String streamId,
                    Object[] metaDataArray,
                    Object[] correlationDataArray,
                    Object[] payloadDataArray,
                    Map<String,String> arbitraryDataMap)
             throws AgentException
Publishing events to the server

Parameters:
streamId - of the stream on which the events are published
metaDataArray - metadata array of the event
correlationDataArray - correlation data array of the event
payloadDataArray - payload data array of the event
arbitraryDataMap - arbitrary mata (as meta.),correlation (as correlation.) & payload (as ) data as key-value pairs
Throws:
AgentException

publish

public void publish(String streamId,
                    long timeStamp,
                    Object[] metaDataArray,
                    Object[] correlationDataArray,
                    Object[] payloadDataArray)
             throws AgentException
Publishing events to the server

Parameters:
streamId - of the stream on which the events are published
timeStamp - time stamp of the event
metaDataArray - metadata array of the event
correlationDataArray - correlation data array of the event
payloadDataArray - payload data array of the event
Throws:
AgentException

publish

public void publish(String streamId,
                    long timeStamp,
                    Object[] metaDataArray,
                    Object[] correlationDataArray,
                    Object[] payloadDataArray,
                    Map<String,String> arbitraryDataMap)
             throws AgentException
Publishing events to the server

Parameters:
streamId - of the stream on which the events are published
timeStamp - time stamp of the event
metaDataArray - metadata array of the event
correlationDataArray - correlation data array of the event
payloadDataArray - payload data array of the event
arbitraryDataMap - arbitrary mata (as meta.),correlation (as correlation.) & payload (as ) data as key-value pairs
Throws:
AgentException

stop

public void stop()
Disconnecting from the server


stopNow

public void stopNow()
Disconnecting from the server



Copyright © 2015 WSO2. All rights reserved.