public static interface SourceHandler.SourceServiceProperties.Builder
A new instance of such a builder can be created using
DiffusionGatewayFramework.newSourceServicePropertiesBuilder()
.
Modifier and Type | Method and Description |
---|---|
SourceHandler.SourceServiceProperties |
build()
Create a
SourceHandler.SourceServiceProperties instance with the
current settings of this builder. |
SourceHandler.SourceServiceProperties.Builder |
payloadConverter(PayloadConverter<?,?> converter)
Specifies a payload converter to use for this service.
|
SourceHandler.SourceServiceProperties.Builder |
payloadConverter(String name)
Specifies the name of a payload converter to use for this
service.
|
SourceHandler.SourceServiceProperties.Builder |
payloadConverter(String name,
Map<String,Object> parameters)
Specifies the name of a payload converter and parameters the
converter requires to be initialized.
|
SourceHandler.SourceServiceProperties.Builder |
topicType(TopicType type)
Sets the topic type.
|
SourceHandler.SourceServiceProperties.Builder |
updateMode(UpdateMode updateMode)
Sets the update mode to be used for topics published to by the
service.
|
SourceHandler.SourceServiceProperties.Builder topicType(TopicType type)
If this is not set the value will be decided by the
build()
method according to whether a payload converter
has been specified or not.
type
- the topic type. Setting to null removes any
previously specified topic typefor details on how supplied topic type and
converters will be validated
SourceHandler.SourceServiceProperties.Builder payloadConverter(String name) throws InvalidConfigurationException
The framework will use a converter with the supplied name and add to the list of converters for this service.
This method can be used instead of payloadConverter(String, Map)
or
payloadConverter(PayloadConverter)
to let the
framework use the converter with the supplied name, if it
does not require any instantiation parameters.
This can be called multiple times to assign multiple converters for the service.
One of the converters defined in PayloadConverter
can be explicitly specified if required.
name
- the payload converter name.InvalidConfigurationException
- if name is null or empty or a
payload
converter
with the given name could not be foundApplicationInitializationException
- if the converter
with the supplied name is not allowed to be used for the
applicationfor details on how supplied topic type and
converters will be validated and how converters will be executed
SourceHandler.SourceServiceProperties.Builder payloadConverter(String name, Map<String,Object> parameters) throws InvalidConfigurationException
The framework will instantiate a converter with the supplied details and add to the list of converters for this service.
This method can be used instead of payloadConverter(String)
or
payloadConverter(PayloadConverter)
to let the
framework use the converter with the supplied name and
parameters.
This can be called multiple times to assign multiple converters for the service.
name
- the converter name.parameters
- the parameters required to instantiate the
converter.InvalidConfigurationException
- if name is null or empty or a
payload
converter
with the given name could not be foundApplicationInitializationException
- if the converter
with the supplied name is not allowed to be used for the
application or the payload converter instantiation failsfor details on how supplied topic type and
converters will be validated and how converters will be executed
SourceHandler.SourceServiceProperties.Builder payloadConverter(PayloadConverter<?,?> converter) throws InvalidConfigurationException
This method can be used instead of
payloadConverter(String)
or payloadConverter(String, Map)
in cases where an
instantiated converter needs to be supplied.
This can be called multiple times to assign multiple converters for the service.
converter
- the converter.InvalidConfigurationException
- if converter is nullApplicationInitializationException
- if the converter
with the supplied name is not allowed to be used for the
applicationfor details on how supplied topic type and
converters will be validated and how converters will be executed
SourceHandler.SourceServiceProperties.Builder updateMode(UpdateMode updateMode)
The default, if not set is STREAMING
.
updateMode
- the update modeSourceHandler.SourceServiceProperties build() throws InvalidConfigurationException
SourceHandler.SourceServiceProperties
instance with the
current settings of this builder.
If no topic type has been specified, it will be derived from
the last payload converter in the list and if no
payload converter has been
specified it will be assumed to be TopicType.JSON
.
If no payload converter is set standard conversions as described
in "Payload Converters"
will be used according to the chosen topic
type.
If a single converter has been assigned for this service, its output type should correspond to the Diffusion topic type, which must be compatible with the topic type if it has already been specified. This also applies to the last converter in the collection, if multiple converters have been assigned for the service.
If multiple converters are specified, they will be called in
order. This order will be determined by the order the
converters are added in the builder using
payloadConverter(String)
or
payloadConverter(String, Map)
or
payloadConverter(PayloadConverter)
. Thus,
the input and output types of the converters in the chain should
match their predecessor and follower. This means that the
input type of the second converter in the chain should be the
same as, or a superclass or superinterface of, the output type
of the previous converter, and so on.
For example, consider following to create a SourceServiceProperties:
newSourceServicePropertiesBuilder() .topicType(TopicType.JSON) .payloadConverter(converter1) .payloadConverter("converter2",parameters) .payloadConverter("converter3") .build();With the above code snippet, a list of converters will be created containing 'converter1', "converter2", and "converter3" in order. The output type of 'converter3' should match the 'TopicType.JSON' topic type, and its input type should match the output type of 'converter2'. Similarly, the input type of 'converter2' should match the output type of 'converter1', and the output type should match the input type of 'converter3', and so on.
InvalidConfigurationException
- if the topic type and
output type of the last payload converter are
incompatible or if the output type of the last
payload converter is not specific to a Diffusion
topic type.Copyright © 2024 DiffusionData Limited. All rights reserved.