org.wso2.carbon.databridge.agent.exception.DataEndpointAuthenticationException Java Examples
The following examples show how to use
org.wso2.carbon.databridge.agent.exception.DataEndpointAuthenticationException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Wso2EventClient.java From product-cep with Apache License 2.0 | 6 votes |
public static void publish(String protocol, String host, String port, String username, String password, String streamId,String dataFileName, String testCaseFolderName, StreamDefinition streamDefinition, int events, int delay) throws MalformedStreamDefinitionException, StreamDefinitionException, DifferentStreamDefinitionAlreadyDefinedException, MalformedURLException, NoStreamDefinitionExistException, AuthenticationException, TransportException, SocketException, DataEndpointAgentConfigurationException, DataEndpointException, DataEndpointAuthenticationException, DataEndpointConfigurationException { String relativeFilePath = getTestDataFileLocation(testCaseFolderName, dataFileName); KeyStoreUtil.setTrustStoreParams(); //create data publisher DataPublisher dataPublisher = new DataPublisher(protocol, "tcp://" + host + ":" + port, null, username, password); //Publish event for a valid stream publishEvents(dataPublisher, streamDefinition, relativeFilePath, events, delay); dataPublisher.shutdown(); }
Example #2
Source File: HTTPMonitoringDataPublisher.java From msf4j with Apache License 2.0 | 5 votes |
private void init(DasConfig dasConfig) { if (logger.isInfoEnabled()) { logger.info("Initializing HTTP Monitoring Data Publisher"); } String type = dasConfig.getType(); String receiverURL = dasConfig.getReceiverURL(); String authURL = dasConfig.getAuthURL(); String username = dasConfig.getUsername(); String password = dasConfig.getPassword(); String dataAgentConfigPath = dasConfig.getDataAgentConfigPath(); if (type == null) { throw new IllegalArgumentException("Type cannot be null"); } if (receiverURL == null) { throw new IllegalArgumentException("Data Receiver URL cannot be null"); } if (username == null) { throw new IllegalArgumentException("Username cannot be null"); } if (password == null) { throw new IllegalArgumentException("Password cannot be null"); } if (dataAgentConfigPath == null) { throw new IllegalArgumentException("Data Agent Configuration Path cannot be null"); } AgentHolder.setConfigPath(dataAgentConfigPath); arbitraryAttributes = SystemVariableUtil.getArbitraryAttributes(); try { dataPublisher = new DataPublisher(type, receiverURL, authURL, username, password); } catch (DataEndpointAgentConfigurationException | DataEndpointException | DataEndpointConfigurationException | DataEndpointAuthenticationException | TransportException e) { throw new IllegalStateException("Error when initializing the Data Publisher", e); } }
Example #3
Source File: StockQuoteClient.java From product-cep with Apache License 2.0 | 5 votes |
public static void publish(String host, String port, String username, String password, int events) throws MalformedStreamDefinitionException, StreamDefinitionException, DifferentStreamDefinitionAlreadyDefinedException, MalformedURLException, AuthenticationException, NoStreamDefinitionExistException, org.wso2.carbon.databridge.commons.exception.AuthenticationException, TransportException, SocketException, DataEndpointAgentConfigurationException, DataEndpointException, DataEndpointAuthenticationException, DataEndpointConfigurationException { System.out.println("Starting Stock quote Agent"); KeyStoreUtil.setTrustStoreParams(); //create data publisher DataPublisher dataPublisher = new DataPublisher("tcp://" + host + ":" + port, username, password); String streamId = DataBridgeCommonsUtils.generateStreamId(STREAM_NAME1, VERSION1); //Publish event for a valid stream if (!streamId.isEmpty()) { System.out.println("Stream ID: " + streamId); while (sentEventCount < events) { dataPublisher.publish(streamId, null, null, getPayload()); sentEventCount++; System.out.println("Events published : " + sentEventCount); } try { Thread.sleep(3000); } catch (InterruptedException e) { //ignore } dataPublisher.shutdown(); } }
Example #4
Source File: AnalyticStatClient.java From product-cep with Apache License 2.0 | 4 votes |
public static void publish(String host, String port, String username, String password, int events) throws MalformedStreamDefinitionException, StreamDefinitionException, DifferentStreamDefinitionAlreadyDefinedException, MalformedURLException, AuthenticationException, NoStreamDefinitionExistException, org.wso2.carbon.databridge.commons.exception.AuthenticationException, TransportException, SocketException, DataEndpointAgentConfigurationException, DataEndpointException, DataEndpointAuthenticationException, DataEndpointConfigurationException { System.out.println("Starting Statistics Agent"); KeyStoreUtil.setTrustStoreParams(); //create data publisher DataPublisher dataPublisher = new DataPublisher("tcp://" + host + ":" + port, username, password); // StreamDefinition streamDefinition = new StreamDefinition(STREAM_NAME1, VERSION1); // streamDefinition.addMetaData("ipAdd", AttributeType.STRING); // streamDefinition.addMetaData("index", AttributeType.LONG); // streamDefinition.addMetaData("timestamp", AttributeType.LONG); // streamDefinition.addMetaData("nanoTime", AttributeType.LONG); // streamDefinition.addPayloadData("userID", AttributeType.STRING); // streamDefinition.addPayloadData("searchTerms", AttributeType.STRING); // String streamId = dataPublisher.defineStream(streamDefinition); String streamId = DataBridgeCommonsUtils.generateStreamId(STREAM_NAME1, VERSION1); //Publish event for a valid stream if (!streamId.isEmpty()) { System.out.println("Stream ID: " + streamId); while (sentEventCount < events) { dataPublisher.publish(streamId, getMeta(), null, getPayload()); sentEventCount++; System.out.println("Events published : " + sentEventCount); } try { Thread.sleep(3000); } catch (InterruptedException e) { //ignore } dataPublisher.shutdown(); } }
Example #5
Source File: HttpdLogAgent.java From product-cep with Apache License 2.0 | 4 votes |
public static void main(String[] args) throws SocketException, MalformedURLException, AuthenticationException, TransportException, StreamDefinitionException, MalformedStreamDefinitionException, DifferentStreamDefinitionAlreadyDefinedException, FileNotFoundException, UnknownHostException, DataEndpointAuthenticationException, DataEndpointAgentConfigurationException, DataEndpointException, DataEndpointConfigurationException { System.out.println("Starting HttpLog Agent"); DataPublisherUtil.setTrustStoreParams(); AgentHolder.setConfigPath(DataPublisherUtil.getAgentConfigPath()); String host = args[0]; String port = args[1]; String username = args[2]; String password = args[3]; //create data publisher DataPublisher dataPublisher = new DataPublisher("tcp://" + host + ":" + port, username, password); String streamId = DataBridgeCommonsUtils.generateStreamId(HTTPD_LOG_STREAM,VERSION); // try { // streamId = dataPublisher.findStream(HTTPD_LOG_STREAM, VERSION); // System.out.println("Stream already defined"); // // } catch (NoStreamDefinitionExistException e) { // //Define event stream // streamId = dataPublisher.defineStream("{" + // " 'name':'" + HTTPD_LOG_STREAM + "'," + // " 'version':'" + VERSION + "'," + // " 'nickName': 'Httpd_Log_Stream'," + // " 'description': 'Sample of Httpd logs'," + // " 'metaData':[" + // " {'name':'clientType','type':'STRING'}" + // " ]," + // " 'payloadData':[" + // " {'name':'log','type':'STRING'}" + // " ]" + // "}"); // // } if (null != streamId && !streamId.isEmpty()) { publishLogEvents(dataPublisher, streamId); } try { Thread.sleep(2000); } catch (InterruptedException e) { } dataPublisher.shutdownWithAgent(); }