Interface ConnectorRequest<R extends ConnectorResponse>

  • All Known Implementing Classes:
    AbstractConnectorRequest

    public interface ConnectorRequest<R extends ConnectorResponse>

    A connector request. The request opens an interaction with the connector. Because a request represents a single interaction, the request is not thread-safe. Request objects should not be shared between multiple threads.

    The parameters of a request can be provided using the generic map of input parameters. See (setRequestParameters(Map)): SomeConnectorRequest req = connector.createRequest(); req.setRequestParameter("endpointUrl", "http://mysystem.loc/foo"); req.setRequestParameter("payload", "some important payload"); req.execute(); This makes it possible to use the connector in a generic / configurable system like the camunda process engine.

    Optionally, a connector may also extend the request interface and provide dedicated (type-safe) methods for configuring a request, preferably in a fluent API fashion: connector.createRequest() .endpointUrl("http://mysystem.loc/foo") .payload("some important payload") .execute(); This makes it easy to use the connector in a standalone way.

    A request must return a ConnectorResponse that contains response data. Requests for which the response contains no payload or is not relevant should return an empty response that provides no data.

    Author:
    Daniel Meyer
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      R execute()
      Execute the request.
      <V> V getRequestParameter​(java.lang.String name)
      Returns the value of a request parameter
      java.util.Map<java.lang.String,​java.lang.Object> getRequestParameters()
      Returns the map of request parameters
      void setRequestParameter​(java.lang.String name, java.lang.Object value)
      Provides a named input parameters to the request.
      void setRequestParameters​(java.util.Map<java.lang.String,​java.lang.Object> params)
      Provides the named input parameters of the request.
    • Method Detail

      • setRequestParameters

        void setRequestParameters​(java.util.Map<java.lang.String,​java.lang.Object> params)
        Provides the named input parameters of the request.
        Parameters:
        params - the named input parameters of the request.
      • setRequestParameter

        void setRequestParameter​(java.lang.String name,
                                 java.lang.Object value)
        Provides a named input parameters to the request.
        Parameters:
        name - the name of the parameter
        value - the value of the parameter
      • getRequestParameters

        java.util.Map<java.lang.String,​java.lang.Object> getRequestParameters()
        Returns the map of request parameters
        Returns:
        the map of request parameters
      • getRequestParameter

        <V> V getRequestParameter​(java.lang.String name)
        Returns the value of a request parameter
        Parameters:
        name - the name of the request parameter
        Returns:
        the value of the request parameter of 'null' if the parameter is not set.
      • execute

        R execute()
        Execute the request. Once a request is configured with all input parameters, it can be executed.
        Returns:
        the return value of the request.