Package org.gcube.event.publisher
Class AbstractEventPublisher
java.lang.Object
org.gcube.event.publisher.AbstractEventPublisher
- All Implemented Interfaces:
EventPublisher
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionChecks for the workflow results status.protected abstract EventSenderprotected ResultsParserintReturns the last returned HTTP response code of a check.intReturns the last returned HTTP response code of a publish.booleanTells if the last check was a success or not.booleanTells if the last publish was a success or not.voidPublish a new event and nothing more.Publishes a new event and optionally wait for the result.publishAndCheck(Event event) Publish an event and immediately checks for the results status.publishAndCheck(Event event, int delayMS) Publish an event and checks for the results status after a delay.refresh(EventStatus eventStatus) Refreshes an event status by checking for the status of the workflow execution represented by theEventStatus.getInstanceId()string.voidsetEventSender(EventSender eventSender) voidsetResultsParser(ResultsParser resultsParser)
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
AbstractEventPublisher
public AbstractEventPublisher()
-
-
Method Details
-
publish
Description copied from interface:EventPublisherPublish a new event and nothing more. The sender is not interested to the success/failure of the send. The results on the workflow engine, is the start of an instance of the workflow identified by theEvent.getName()string.- Specified by:
publishin interfaceEventPublisher- Parameters:
event- the event to be published
-
publish
Description copied from interface:EventPublisherPublishes a new event and optionally wait for the result. IfwaitForResultparameter isfalsethe behavior is the same of theEventPublisher.publish(Event)method, if true, the workflow id is returned as string if the publish had success.- Specified by:
publishin interfaceEventPublisher- Parameters:
event- the vent to be publishedwaitForResult- if the sender is interested or not to the resulting workflow id- Returns:
- the resulting workflow id
-
isLastPublishOK
public boolean isLastPublishOK()Description copied from interface:EventPublisherTells if the last publish was a success or not.- Specified by:
isLastPublishOKin interfaceEventPublisher- Returns:
trueif the publish was OK,falseotherwise
-
getLastPublishEventHTTPResponseCode
public int getLastPublishEventHTTPResponseCode()Description copied from interface:EventPublisherReturns the last returned HTTP response code of a publish. E.g. 200 if the send was OK or 404 if the event doesn't have a corresponding workflow definition.- Specified by:
getLastPublishEventHTTPResponseCodein interfaceEventPublisher- Returns:
- the HTTP response code of the last publish or -1 if an error occurred before the call (e.g. during the authorization or connection)
-
publishAndCheck
Description copied from interface:EventPublisherPublish an event and immediately checks for the results status. The behavior is the same of theEventPublisher.publishAndCheck(Event, int)withdelayMSargument less or equal to 0.- Specified by:
publishAndCheckin interfaceEventPublisher- Parameters:
event- the event to be published- Returns:
- an object with info about the event's running status
-
publishAndCheck
Description copied from interface:EventPublisherPublish an event and checks for the results status after a delay. The behavior is the same of theEventPublisher.publishAndCheck(Event)if delayMS argument is less or equal to 0.- Specified by:
publishAndCheckin interfaceEventPublisher- Parameters:
event- the event to be publisheddelayMS- the delay betwen the publish and the query calls- Returns:
- an object with info about the event's running status
-
check
Description copied from interface:EventPublisherChecks for the workflow results status.- Specified by:
checkin interfaceEventPublisher- Parameters:
instanceId- the workflow instance id, resulting of theEventPublisher.publish(Event, boolean)withwaitForResultas true.- Returns:
- an object with info about the event's running status
-
refresh
Description copied from interface:EventPublisherRefreshes an event status by checking for the status of the workflow execution represented by theEventStatus.getInstanceId()string.- Specified by:
refreshin interfaceEventPublisher- Parameters:
eventStatus- a previously obtained event status.- Returns:
- an object with new info about the event's running status
-
isLastCheckOK
public boolean isLastCheckOK()Description copied from interface:EventPublisherTells if the last check was a success or not.- Specified by:
isLastCheckOKin interfaceEventPublisher- Returns:
trueif the publish was OK,falseotherwise
-
getLastCheckHTTPResponseCode
public int getLastCheckHTTPResponseCode()Description copied from interface:EventPublisherReturns the last returned HTTP response code of a check. E.g. 200 if the send was OK or 404 if the event doesn't have a corresponding workflow instance.- Specified by:
getLastCheckHTTPResponseCodein interfaceEventPublisher- Returns:
- the HTTP response code of the last publish or -1 if an error occurred before the call (e.g. during the authorization or connection)
-
createEventSender
-
createResultsParser
-
getEventSender
-
setEventSender
-
getResultsParser
-
setResultsParser
-