\r\n

51Degrees API Documentation  4.2Newer Version 4.4

Introduction

Flow elements are constructed using a builder which follows the fluent builder pattern. This gives a consistent structure when building any flow element and allows automatic building via configuration files.

Typically the flow element built by an element builder is added to a Pipeline via a pipeline builder.

By convention, the configuration of a flow element is immutable once it has been constructed, so all configuration should be done in the builder.

Configuration

Following the convention of fluent builder, configuration methods are prefixed with 'set'. For example, the method to set a configuration option with the name 'cachesize' would have a 'SetCacheSize' method which takes the value of the option as an argument and returns the builder.

The precise constraints around these methods vary by language.

Select a language.

Building

Once all options are set in the builder, a 'build' method is used to build and return a flow element with the configuration provided. A build method can take additional arguments and a builder may have multiple build methods. When an argument appears on all build methods for that builder it becomes compulsory.

For example, a 'resource key' is compulsory for 51Degrees' cloud engines. Consequently, it appears as an argument in all build methods for the associated builders.

Combinations of compulsory arguments can also be arranged. For example, 51Degrees' on-premise engines require either a filename or a data structure containing the file data in memory. Therefore they have two build methods, one taking a filename and the other taking the memory-based data structure.

Usage

Select a language.