org.camunda.connect.spi
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.

The request may return a value representing the output of the connector invocation. Requests not returning a value should be of type Void.

Author:
Daniel Meyer

Method Summary
 R execute()
          Execute the request.
<V> V
getRequestParameter(String name)
          Returns the value of a request parameter
 Map<String,Object> getRequestParameters()
          Returns the map of request parameters
 void setRequestParameter(String name, Object value)
          Provides a named input parameters to the request.
 void setRequestParameters(Map<String,Object> params)
          Provides the named input parameters of the request.
 

Method Detail

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.


Copyright © 2014 camunda services GmbH. All rights reserved.