Interface ConnectorRequest<R extends ConnectorResponse>

All Known Subinterfaces:
HttpBaseRequest<Q,R>, HttpMethodRequest<Q,R>, HttpRequest, SoapHttpRequest
All Known Implementing Classes:
AbstractConnectorRequest, AbstractHttpRequest, HttpRequestImpl, SoapHttpRequestImpl

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 Details

    • setRequestParameters

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

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

      Map<String,Object> getRequestParameters()
      Returns the map of request parameters
      Returns:
      the map of request parameters
    • getRequestParameter

      <V> V getRequestParameter(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.