/** * This method will be called before the processing method. * Intention to establish connection to publish event. * such that the system will take care retrying for connection */ @Override public void connect() { if (publisherURLOption.isStatic()) { log.info(streamID + " has successfully connected to " + publisherURL); } }
/** * 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); } }
if ((attachmentOption != null) && (!attachmentOption.isStatic())) { attachments = Arrays.asList(attachmentOption.getValue(dynamicOptions).split(EmailConstants.COMMA_SEPERATOR));
void initClientConnector(DynamicOptions dynamicOptions) { if (publisherURLOption.isStatic()) { publisherURL = publisherURLOption.getValue(); } else {
private int sendRequest(Object payload, DynamicOptions dynamicOptions, List<Header> headersList, int tryCount) { if (!publisherURLOption.isStatic()) { super.initClientConnector(dynamicOptions);
private int sendRequest(Object payload, DynamicOptions dynamicOptions, List<Header> headersList) { if (publisherURLOption.isStatic()) { if (clientConnector != null) { clientConnector.close();
if (attachmentOption.isStatic()) { attachments = Arrays.asList(attachmentOption.getValue().split(EmailConstants.COMMA_SEPERATOR));
authType = HttpConstants.NO_AUTH; if (publisherURLOption.isStatic()) { initClientConnector(null);