Package org.gcube.event.publisher
Interface EventPublisher
-
- All Known Implementing Classes:
AbstractEventPublisher
public interface EventPublisher
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EventStatuscheck(String instanceId)Checks for the workflow results status.intgetLastCheckHTTPResponseCode()Returns the last returned HTTP response code of a check.intgetLastPublishEventHTTPResponseCode()Returns the last returned HTTP response code of a publish.booleanisLastCheckOK()Tells if the last check was a success or not.booleanisLastPublishOK()Tells if the last publish was a success or not.voidpublish(Event event)Publish a new event and nothing more.Stringpublish(Event event, boolean waitForResult)Publishes a new event and optionally wait for the result.EventStatuspublishAndCheck(Event event)Publish an event and immediately checks for the results status.EventStatuspublishAndCheck(Event event, int delayMS)Publish an event and checks for the results status after a delay.EventStatusrefresh(EventStatus eventStatus)Refreshes an event status by checking for the status of the workflow execution represented by theEventStatus.getInstanceId()string.
-
-
-
Method Detail
-
publish
void publish(Event event)
Publish 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.- Parameters:
event- the event to be published
-
publish
String publish(Event event, boolean waitForResult)
Publishes a new event and optionally wait for the result. IfwaitForResultparameter isfalsethe behavior is the same of thepublish(Event)method, if true, the workflow id is returned as string if the publish had success.- 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
boolean isLastPublishOK()
Tells if the last publish was a success or not.- Returns:
trueif the publish was OK,falseotherwise
-
getLastPublishEventHTTPResponseCode
int getLastPublishEventHTTPResponseCode()
Returns 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.- 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
EventStatus publishAndCheck(Event event)
Publish an event and immediately checks for the results status. The behavior is the same of thepublishAndCheck(Event, int)withdelayMSargument less or equal to 0.- Parameters:
event- the event to be published- Returns:
- an object with info about the event's running status
-
publishAndCheck
EventStatus publishAndCheck(Event event, int delayMS)
Publish an event and checks for the results status after a delay. The behavior is the same of thepublishAndCheck(Event)if delayMS argument is less or equal to 0.- 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
EventStatus check(String instanceId)
Checks for the workflow results status.- Parameters:
instanceId- the workflow instance id, resulting of thepublish(Event, boolean)withwaitForResultas true.- Returns:
- an object with info about the event's running status
-
refresh
EventStatus refresh(EventStatus eventStatus)
Refreshes an event status by checking for the status of the workflow execution represented by theEventStatus.getInstanceId()string.- Parameters:
eventStatus- a previously obtained event status.- Returns:
- an object with new info about the event's running status
-
isLastCheckOK
boolean isLastCheckOK()
Tells if the last check was a success or not.- Returns:
trueif the publish was OK,falseotherwise
-
getLastCheckHTTPResponseCode
int getLastCheckHTTPResponseCode()
Returns 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.- 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)
-
-