Skip to content

Service Description

Joseph Szobody edited this page Mar 29, 2016 · 2 revisions

The SDK Client requires a Service instance to describe the remote service. The Service class accepts a description array.

Top level attributes

Name Value Required Description
name string yes Name of service
baseUrl string yes Base URL of the web service. Any relative URI specified in an operation will be merged with the baseUrl. If an operation has a full URI then the baseUrl is ignored.
operations array details yes Operations of the service. The key is the name of the operation and value is the attributes of the operation.
cache array details no Caching settings. If not specified, no caching will be used at all.
circuitBreaker array details no Circuit Breaker settings. Required cache to be setup as well.
logger string no Path to a logger class that implements Psr\Log\LoggerInterface. All SDK calls and CircuitBreaker activity will be logged if provided.
pipeline array no Additional pipeline classes to include during request processing. See below.
options array no Guzzle request options. See Guzzle docs.

Example

[
    "name" => "My Service",
    "baseUrl" => "http://myservice.local",
    "logger" => \My\Psr\LoggerClass::class,
    "cache" => [...],
    "circuitBreaker" => [...],
    "operations" => [...]
]

Pipeline additions

You can specify additional custom pipeline classes to include during request processing. These classes should implement PipeInterface.

The pipeline array supports two sub-arrays for appending or prepending the pipeline, depending on what your class does.

Example:

[
    ...
    'pipeline' => [
        'prepend' => [
            \Path\To\FirstClass::class,
            \Path\To\SecondClass::class
        ],
        'append' => [
            \Path\To\AnotherClass::class
        ]
    ]
]
Clone this wiki locally