Skip to content

Toro Cloud Dev Center


Tracker resubmit endpoint

The Tracker resubmit endpoint is a custom Martini endpoint used in conjunction with the Tracker search index. Logging transactions in Tracker provides an audit trail for every transaction and their state. Should a transaction fail for any reason, the error can be discovered using data stored in the Tracker search index. The Tracker resubmit endpoint enables a user to arbitrage errors and then retry failed transactions by either processing them through the original service or a custom service that may have been designed to handle failed transactions.

The Tracker resubmit endpoint needs to be registered against a Tracker document type and an associated state. The endpoint will be active against documents that are of the same type and state. You then specify which service should be invoked by the Tracker resubmit endpoint should it get triggered. When the endpoint is finally started, a resubmit option is added to the Tracker UI1 (highlighted below):

Option for resubmitting documents via the UI

Option for resubmitting documents via the UI

Option for resubmitting documents via the UI

In the UI above, the Tracker resubmit endpoint is registered for Tracker documents of type JMS with the state Started. When the resubmit option is clicked, the service associated to this endpoint is executed.

Properties

General configuration

Name Default Description
Name The name of the endpoint.
Service (required) The service to execute when the endpoint is triggered.
Auto Start true Whether or not to automatically run the endpoint upon package startup.

Tracker resubmit-specific configuration

Name Default Description
Document Type Tracker Resubmit The type of the Tracker document in which this endpoint is invocable from.
State (required) The state of the Tracker document in which this endpoint is invocable from.

Service

When the endpoint is triggered, the following variables are exposed to the configured service:

General parameters

Name Type Description
$trackerId java.lang.String The Tracker document internal ID. If the endpoint was configured to not track, this value will be null.
$tracker io.toro.martini.tracker.Tracker The Tracker object. If the endpoint was configured to not track, this value will be null.
martiniPackage MartiniPackage The Martini package that contains the endpoint.
parameters java.util.Map A map containing all the endpoint specific parameters.
properties java.util.Map A map containing containing all the properties associated with the endpoint.

Tracker resubmit-specific parameters

Name Type Description
document Document The Tracker document object that the re-submit is being performed on.
externalId java.lang.String The Tracker document external ID.
documentType Type The Tracker document type object that the re-submit is being performed on.
documentTypeId java.lang.String The Tracker document type ID.
stateId long The Tracker document state ID that the re-submit is being performed on.
stateName java.lang.String The Tracker document state name that the re-submit is being performed on.
senderId java.lang.String The Tracker document sender ID.
receiverId java.lang.String The Tracker document receiver ID.
userName java.lang.String The Tracker document user name.
documentState State The Tracker document state object that the re-submit is being performed on.
inputStream java.io.InputStream The document state's content as an InputStream. This stream will point to the actual content of the document state. If there is no content, this will be null.
reader java.io.Reader The document state's content as a Reader. This reader will point to the actual content of the document state. If there is no content, this will be null.
bytes byte[] The document state's content in bytes. If there is no content, this will be null.
content java.lang.String The document state's content, expressed as a string. If there is no content, this will be null.
file java.nio.file.Path The document state's content, ported in a file. This is a temporary file that will be deleted after your endpoints are invoked. It will point to a file containing the actual content of the document state. If there is no content, this will be null.

Example

Consider the following Tracker resubmit endpoint configuration:

Tracker resubmit endpoint, sample configuration

This registers the Tracker resubmit endpoint for Tracker documents of type RSS with the state Started. The service assigned to this endpoint is as follows:

Registered service for sample Tracker resubmit endpoint

  • (1) Logs a message to underlying log engine
  • (2) Looks for the Tracker property keyed Resubmit Count.
  • (3-4) Checks and increments the property accordingly, to keep track how many times this was resubmitted
  • (5) Re-persist the property

Using this feature, developers can potentially re-execute customized logic based on the tracked content of the original Tracker document.

Want more examples?

The distribution ships with a Martini package called examples, which contains services demonstrating more use cases.


  1. Only for document states that match the endpoint's configured document state and type.