Class RetryFromJetty

  • All Implemented Interfaces:
    AdaptrisComponent, ComponentLifecycle, ComponentLifecycleExtension, FailedMessageRetrier

    @ComponentProfile(summary="Listen for HTTP traffic on the specified URI and retry messages",
                      recommended={EmbeddedConnection.class,JettyConnection.class},
                      since="3.11.1")
    public class RetryFromJetty
    extends FailedMessageRetrierImp
    FailedMessageRetrier implementation that retries upon demand.

    This implementation listens on the specified jetty endpoint(s) and allows you to retry failed message by ID and list the contents of the data store that contains failed messages. Sometimes we can't rely on standard error handlers/retriers to retry failed messages. This is intended to codify some of the concepts discussed here into a simpler configuration chain.

    This jetty implementation allows two modes of operation. Listing the failed messages, retrying a message, deleting messages from the store.

    • curl -XGET http://localhost:8080/api/failed/list gives you a list of message ids that are listed in the store
    • curl -XPOST http://localhost:8080/api/retry/[msgId] will attempt to resubmit the message to the appropriate workflow; returning a 202 upon success
    • curl -XDELETE http://localhost:8080/api/failed/delete/[msgId] will attempt to delete the message from the store
      • While DELETE is available, this implementation doesn't make any checks that the messages that you have retried have been retried successfuly. It is expected that you have separate tooling that allows you to verify that retried-messages are ultimately sucessfully before triggering the delete. If you ask for a message to be deleted from the store, then that is what happens.

    Since:
    3.11.1

    In the adapter configuration file this class is aliased as retry-via-jetty which is the preferred alternative to the fully qualified classname when building your configuration.

    • Constructor Detail

      • RetryFromJetty

        public RetryFromJetty()
    • Method Detail

      • init

        public void init()
                  throws CoreException
        Description copied from interface: ComponentLifecycle
        Initialises the component.

        Component initialisation includes config verification, creation of connections etc.

        Throws:
        CoreException - wrapping any underlying Exceptions
      • start

        public void start()
                   throws CoreException
        Description copied from interface: ComponentLifecycle
        Starts the component.

        Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer, calling start will begin message delivery.

        Throws:
        CoreException - wrapping any underlying Exceptions
      • stop

        public void stop()
        Description copied from interface: ComponentLifecycle
        Stop the component

        A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer, calling stop will pause message delivery. Throwing a RuntimeException may cause unintended consequences

      • close

        public void close()
        Description copied from interface: ComponentLifecycle
        Closes the component.

        A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException may cause unintended consequences

      • getRetryEndpointPrefix

        public java.lang.String getRetryEndpointPrefix()
        The retry endpoint.

        The default if not explicitly specified is "/api/retry/", note the trailing "/". The expectation is that when clients interact with the endpoint it will be in the form /prefix/'msgId'

      • setRetryEndpointPrefix

        public void setRetryEndpointPrefix​(java.lang.String retryEndpointPrefix)
        The retry endpoint.

        The default if not explicitly specified is "/api/retry/", note the trailing "/". The expectation is that when clients interact with the endpoint it will be in the form /prefix/'msgId'

      • getReportingEndpoint

        public java.lang.String getReportingEndpoint()
        The endpoint that allows reporting on what has failed.

        The default if not explicitly specified is "/api/failed/list".

      • setReportingEndpoint

        public void setReportingEndpoint​(java.lang.String reportingEndpoint)
        The endpoint that allows reporting on what has failed.

        The default if not explicitly specified is "/api/failed/list".

      • getDeleteEndpointPrefix

        public java.lang.String getDeleteEndpointPrefix()
        The delete endpoint.

        The default if not explicitly specified is "/api/failed/delete/", note the trailing "/". The expectation is that when clients interact with the endpoint it will be in the form /prefix/'msgId'

      • setDeleteEndpointPrefix

        public void setDeleteEndpointPrefix​(java.lang.String deleteEndpointPrefix)
        The delete endpoint.

        The default if not explicitly specified is "/api/failed/delete/", note the trailing "/". The expectation is that when clients interact with the endpoint it will be in the form /prefix/'msgId'

      • getConnection

        public AdaptrisConnection getConnection()
        The underlying Jetty connection.
      • setConnection

        public void setConnection​(AdaptrisConnection connection)
        The underlying Jetty connection.
      • getReportBuilder

        @NonNull
        public @NonNull ReportBuilder getReportBuilder()
        How to build reports.
      • setReportBuilder

        public void setReportBuilder​(@NonNull
                                     @NonNull ReportBuilder reportBuilder)
        How to build reports.
      • getRetryStore

        @NonNull
        public @NonNull RetryStore getRetryStore()
        Where messages are stored for retries.
      • setRetryStore

        public void setRetryStore​(@NonNull
                                  @NonNull RetryStore retryStore)
        Where messages are stored for retries.
      • getRetryHttpMethod

        public java.lang.String getRetryHttpMethod()
        The HTTP method which is required for retries; the default is POST.
      • setRetryHttpMethod

        public void setRetryHttpMethod​(java.lang.String retryHttpMethod)
        The HTTP method which is required for retries; the default is POST.
      • getDeleteHttpMethod

        public java.lang.String getDeleteHttpMethod()
        The HTTP method which is required for deleting messages from the retry store; the default is DELETE.
      • setDeleteHttpMethod

        public void setDeleteHttpMethod​(java.lang.String deleteHttpMethod)
        The HTTP method which is required for deleting messages from the retry store; the default is DELETE.