本文整理了Java中org.wso2.siddhi.core.util.transport.Option.getValue()
方法的一些代码示例,展示了Option.getValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.getValue()
方法的具体详情如下:
包路径:org.wso2.siddhi.core.util.transport.Option
类名称:Option
方法名:getValue
暂无
代码示例来源:origin: org.wso2.extension.siddhi.io.jms/siddhi-io-jms
@Override
public void publish(Object payload, DynamicOptions transportOptions) {
String topicQueueName = destination.getValue(transportOptions);
executorService.execute(new JMSPublisher(topicQueueName, jmsStaticProperties,
clientConnector, payload));
}
代码示例来源:origin: org.wso2.siddhi/siddhi-extension-kafka-output-transport
@Override
public void publish(Object payload, DynamicOptions transportOptions) throws ConnectionUnavailableException {
String topic = topicOption.getValue(transportOptions);
String partitionNo = partitionOption.getValue(transportOptions);
try {
if (null == partitionNo) {
producer.send(new ProducerRecord<>(topic, payload.toString()));
} else {
producer.send(new ProducerRecord<>(topic, partitionNo, payload.toString()));
}
} catch (Exception e) {
log.error(String.format("Failed to publish the message to [topic] %s [partition-no] %s. Error: %s",
topic, partitionNo, e.getMessage()), e);
}
}
代码示例来源:origin: org.wso2.extension.siddhi.io.mqtt/siddhi-io-mqtt
public void publish(Object payload, DynamicOptions dynamicOptions) throws ConnectionUnavailableException {
try {
MqttMessage message = new MqttMessage();
byte[] byteArray;
if (payload instanceof byte[]) {
byteArray = (byte[]) payload;
} else {
byteArray = payload.toString().getBytes("UTF-8");
}
message.setPayload(byteArray);
int qos = Integer.parseInt(qosOption.getValue(dynamicOptions));
boolean messageRetain = Boolean.parseBoolean(messageRetainOption.getValue(dynamicOptions));
message.setQos(qos);
message.setRetained(messageRetain);
String topic = topicOption.getValue(dynamicOptions);
client.publish(topic, message);
} catch (MqttException e) {
log.error("Error occurred when publishing message to the MQTT broker: " + brokerURL + " in "
+ streamDefinition, e);
} catch (UnsupportedEncodingException e) {
log.error("Event could not be encoded in UTF-8, hence it could not be published to MQTT broker: "
+ brokerURL + " in " + streamDefinition, e);
}
}
代码示例来源:origin: org.wso2.extension.siddhi.io.http/siddhi-io-http
/**
* This method will be called when events need to be published via this sink
*
* @param payload payload of the event based on the supported event class exported by the extensions
* @param dynamicOptions holds the dynamic options of this sink and Use this object to obtain dynamic options.
*/
@Override
public void publish(Object payload, DynamicOptions dynamicOptions) {
//get the dynamic parameter
String headers = httpHeaderOption.getValue(dynamicOptions);
List<Header> headersList = HttpSinkUtil.getHeaders(headers);
if (publisherURLOption.isStatic()) {
publisherURL = publisherURLOption.getValue();
} else {
publisherURL = publisherURLOption.getValue(dynamicOptions);
}
if (authType.equals(HttpConstants.BASIC_AUTH) || authType.equals(HttpConstants.NO_AUTH)) {
sendRequest(payload, dynamicOptions, headersList, HttpConstants.MAXIMUM_TRY_COUNT);
} else {
sendOauthRequest(payload, dynamicOptions, headersList);
}
}
代码示例来源:origin: org.wso2.extension.siddhi.io.http/siddhi-io-http
private Map<String, Object> getTrpProperties(DynamicOptions dynamicOptions) {
Event event = dynamicOptions.getEvent();
Object[] data = event.getData();
List<Attribute> attributes = outputStreamDefinition.getAttributeList();
Map<String, Object> trpProperties = new HashMap<>();
for (int i = 0; i < attributes.size(); i++) {
trpProperties.put(attributes.get(i).getName(), data[i]);
}
if (isDownloadEnabled) {
trpProperties.put(HttpConstants.DOWNLOAD_PATH, downloadPath.getValue(dynamicOptions));
}
return trpProperties;
}
代码示例来源:origin: org.wso2.extension.siddhi.io.http/siddhi-io-http
public void getAccessToken(DynamicOptions dynamicOptions, String encodedAuth, String tokenURL) {
this.tokenURL = tokenURL;
HttpsClient httpsClient = new HttpsClient();
if (!HttpConstants.EMPTY_STRING.equals(oauthUsername) &&
!HttpConstants.EMPTY_STRING.equals(oauthUserPassword)) {
httpsClient.getPasswordGrantAccessToken(tokenURL, clientStoreFile,
clientStorePass, oauthUsername, oauthUserPassword, encodedAuth);
} else if (!HttpConstants.EMPTY_STRING.equals(refreshToken.getValue(dynamicOptions)) ||
!accessTokenCache.getRefreshtoken(encodedAuth).equals(HttpConstants.EMPTY_STRING)) {
httpsClient.getRefreshGrantAccessToken(tokenURL, clientStoreFile,
clientStorePass, encodedAuth, refreshToken.getValue(dynamicOptions));
} else {
httpsClient.getClientGrantAccessToken(tokenURL, clientStoreFile,
clientStorePass, encodedAuth);
}
}
代码示例来源:origin: org.wso2.extension.siddhi.io.kafka/siddhi-io-kafka
@Override
public void publish(Object payload, DynamicOptions transportOptions) throws ConnectionUnavailableException {
String key = keyOption.getValue(transportOptions);
Object payloadToSend = null;
try {
代码示例来源:origin: org.wso2.extension.siddhi.io.http/siddhi-io-http
/**
* This method will be called when events need to be published via this sink
*
* @param payload payload of the event based on the supported event class exported by the extensions
* @param dynamicOptions holds the dynamic options of this sink and Use this object to obtain dynamic options.
* @throws ConnectionUnavailableException if end point is unavailable the ConnectionUnavailableException thrown
* such that the system will take care retrying for connection
*/
@Override
public void publish(Object payload, DynamicOptions dynamicOptions) throws ConnectionUnavailableException {
String headers = httpHeaderOption.getValue(dynamicOptions);
List<Header> headersList = HttpSinkUtil.getHeaders(headers);
String messageId = messageIdOption.getValue(dynamicOptions);
String contentType = HttpSinkUtil.getContentType(mapType, headersList);
HTTPSourceRegistry.
getRequestSource(sourceId).handleCallback(messageId, (String) payload, headersList, contentType);
}
代码示例来源:origin: org.wso2.extension.siddhi.io.kafka/siddhi-io-kafka
@Override
public void publish(Object payload, DynamicOptions transportOptions) throws ConnectionUnavailableException {
String topic = topicOption.getValue(transportOptions);
String partitionNo = partitionOption.getValue(transportOptions);
String key = keyOption.getValue(transportOptions);
Object payloadToSend;
代码示例来源:origin: org.wso2.extension.siddhi.io.http/siddhi-io-http
/**
* This method will be called when events need to be published via this sink
*
* @param payload payload of the event based on the supported event class exported by the extensions
* @param dynamicOptions holds the dynamic options of this sink and Use this object to obtain dynamic options.
*/
@Override
public void publish(Object payload, DynamicOptions dynamicOptions) {
//get the dynamic parameter
String headers = httpHeaderOption.getValue(dynamicOptions);
List<Header> headersList = HttpSinkUtil.getHeaders(headers);
if (authType.equals(HttpConstants.BASIC_AUTH) || authType.equals(HttpConstants.NO_AUTH)) {
sendRequest(payload, dynamicOptions, headersList);
} else {
sendOauthRequest(payload, dynamicOptions, headersList);
}
}
代码示例来源:origin: org.wso2.extension.siddhi.io.email/siddhi-io-email
public void publish(Object payload, DynamicOptions dynamicOptions) throws ConnectionUnavailableException {
if (optionSubject != null) {
String subject = optionSubject.getValue(dynamicOptions);
emailProperties.put(EmailConstants.TRANSPORT_MAIL_HEADER_SUBJECT, subject);
String to = optionTo.getValue(dynamicOptions);
emailProperties.put(EmailConstants.TRANSPORT_MAIL_HEADER_TO, to);
String cc = optionCc.getValue(dynamicOptions);
emailProperties.put(EmailConstants.TRANSPORT_MAIL_HEADER_CC, cc);
String bcc = optionBcc.getValue(dynamicOptions);
emailProperties.put(EmailConstants.TRANSPORT_MAIL_HEADER_BCC, bcc);
String contentType = optionContentType.getValue(dynamicOptions);
emailProperties.put(EmailConstants.TRANSPORT_MAIL_HEADER_CONTENT_TYPE, contentType);
Arrays.asList(attachmentOption.getValue(dynamicOptions).split(EmailConstants.COMMA_SEPERATOR));
代码示例来源:origin: org.wso2.extension.siddhi.io.file/siddhi-io-file
String uri = uriOption.getValue(dynamicOptions);
BinaryCarbonMessage binaryCarbonMessage = new BinaryCarbonMessage(ByteBuffer.wrap(byteArray), true);
properties.put(Constants.URI, uri);
代码示例来源:origin: org.wso2.extension.siddhi.map.xml/siddhi-map-xml
SiddhiAppContext siddhiAppContext) {
this.streamDefinition = streamDefinition;
enclosingElement = optionHolder.getOrCreateOption(OPTION_ENCLOSING_ELEMENT, null).getValue();
if (enclosingElement != null) {
endingElement = getClosingElement(enclosingElement);
xmlValidationEnabled = Boolean.parseBoolean(validateXmlOption.getValue());
if (xmlValidationEnabled) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
代码示例来源:origin: org.wso2.extension.siddhi.io.rabbitmq/siddhi-io-rabbitmq
byteArray = payload.toString().getBytes("UTF-8");
String exchangeName = exchangeNameOption.getValue(dynamicOptions);
String exchangeType = exchangeTypeOption.getValue(dynamicOptions);
String headers = headerOption.getValue(dynamicOptions);
String messageId = messageIdOption.getValue(dynamicOptions);
int priority = Integer.parseInt(priorityOption.getValue(dynamicOptions));
String correlationId = correlationIdOption.getValue(dynamicOptions);
Date timestamp;
if (timestampString == null) {
map = RabbitMQSinkUtil.getHeaders(headers);
String routingKey = routingKeyOption.getValue(dynamicOptions);
props = props.builder().
deliveryMode(deliveryMode).
boolean exchangeAutoDelete = Boolean.parseBoolean(exchangeDurableAsStringOption.getValue(dynamicOptions));
boolean exchangeDurable = Boolean.parseBoolean(exchangeAutoDeleteAsStringOption.getValue(dynamicOptions));
} catch (IOException e) {
log.error("Error in sending the message to the " + RabbitMQConstants.RABBITMQ_EXCHANGE_NAME +
" = " + exchangeNameOption.getValue() + " in RabbitMQ broker at " + streamDefinition, e);
} catch (TimeoutException e) {
throw new SiddhiAppCreationException(
"Timeout while publishing the events to " + exchangeNameOption.getValue() + " in " +
"RabbitMQ server", e);
代码示例来源:origin: org.wso2.extension.siddhi.map.csv/siddhi-map-csv
SiddhiAppContext siddhiAppContext) {
this.streamDefinition = streamDefinition;
this.header = Boolean.parseBoolean(optionHolder.getOrCreateOption(HEADER, DEFAULT_HEADER).getValue());
this.eventGroupEnabled = Boolean.valueOf(optionHolder.validateAndGetStaticValue(OPTION_GROUP_EVENTS,
DEFAULT_GROUP_EVENTS));
this.delimiter = optionHolder.getOrCreateOption(DELIMITER, DEFAULT_DELIMITER).getValue().charAt(0);
headerOfData = new Object[streamDefinition.getAttributeNameArray().length];
if (payloadTemplateBuilderMap == null) {
代码示例来源:origin: org.wso2.extension.siddhi.io.http/siddhi-io-http
void initClientConnector(DynamicOptions dynamicOptions) {
if (publisherURLOption.isStatic()) {
publisherURL = publisherURLOption.getValue();
} else {
publisherURL = publisherURLOption.getValue(dynamicOptions);
代码示例来源:origin: org.wso2.extension.siddhi.io.http/siddhi-io-http
super.initClientConnector(dynamicOptions);
String httpMethod = EMPTY_STRING.equals(httpMethodOption.getValue(dynamicOptions)) ?
HttpConstants.METHOD_DEFAULT : httpMethodOption.getValue(dynamicOptions);
String contentType = HttpSinkUtil.getContentType(mapType, headersList);
String messageBody = getMessageBody(payload);
代码示例来源:origin: org.wso2.extension.siddhi.io.http/siddhi-io-http
String httpMethod = EMPTY_STRING.equals(httpMethodOption.getValue(dynamicOptions)) ?
HttpConstants.METHOD_DEFAULT : httpMethodOption.getValue(dynamicOptions);
String contentType = HttpSinkUtil.getContentType(mapType, headersList);
String messageBody = getMessageBody(payload);
代码示例来源:origin: org.wso2.extension.siddhi.io.rabbitmq/siddhi-io-rabbitmq
RabbitMQConstants.NULL);
if (!RabbitMQConstants.EXCHANGE_TYPE_FANOUT.equals(exchangeTypeOption.getValue())
&& !RabbitMQConstants.EXCHANGE_TYPE_DIRECT.equals(exchangeTypeOption.getValue())
&& !RabbitMQConstants.EXCHANGE_TYPE_TOPIC.equals(exchangeTypeOption.getValue())
&& !RabbitMQConstants.EXCHANGE_TYPE_HEADERS.equals(exchangeTypeOption.getValue())) {
throw new SiddhiAppCreationException("Check the exchange type in " + this.streamDefinition + ". " +
"There is no exchange type named as " + exchangeTypeOption.getValue() + " in RabbitMQ");
代码示例来源:origin: org.wso2.extension.siddhi.io.email/siddhi-io-email
attachmentOption = optionHolder.validateAndGetOption(EmailConstants.ATTACHMENTS);
if (attachmentOption.isStatic()) {
attachments = Arrays.asList(attachmentOption.getValue().split(EmailConstants.COMMA_SEPERATOR));
内容来源于网络,如有侵权,请联系作者删除!