Upgrading from version 1.x to version 2.0
In the 2.0 version of the Gateway Framework, the term convertor has been changed to converter throughout the APIs, affecting method names, interface names, etc. Additionally, there are other API changes that can lead to compile errors. These changes are listed below:
-
The
getPayloadConvertorName()
method incom.diffusiondata.gateway.framework.SourceHandler.SourceServiceProperties
has been changed togetPayloadConverterNames()
, which returns a list of Strings instead of a single String. -
payloadConvertorName(String name)
incom.diffusiondata.gateway.framework.SourceHandler.SourceServiceProperties.Builder
has been changed topayloadConverter(String name)
. -
The
getPayloadConvertorName()
method incom.diffusiondata.gateway.framework.SinkHandler.SinkServiceProperties
has been changed togetPayloadConverterNames()
, which returns a list of Strings instead of a single String. -
payloadConvertorName(String name)
incom.diffusiondata.gateway.framework.SinkHandler.SinkServiceProperties.Builder
has been changed topayloadConverter(String name)
. -
The
PayloadConvertor
interface has been renamed toPayloadConverter
and methods has been changed. See writing payload converter for details on how to implement a PayloadConverter with the changed API. -
The
InboundPayloadConvertor
andOutboundPayloadConvertor
interfaces have been removed. So,PayloadConverter
interface should be used to implement a payload converter. -
com.diffusiondata.gateway.framework.SinkHandler
requires a new methodvalueType()
. -
update
method incom.diffusiondata.gateway.framework.SinkHandler
has been updated to containTopicProperties
that contains details of the topic from where update is received. This can be used as required or ignored. -
The
isMetricsEnabled
method inGatewayFramework
has been moved toApplicationDefinition
. -
The
getExecutorService
method inGatewayFramework
has been moved toApplicationDefinition
. -
The
getParameters()
method inApplicationDefinition
has been renamed togetGlobalConfiguration
. -
The
ApplicationDefinition
interface has been renamed toApplicationContext
. -
The
connect
method of theGatewayFramework
interface has been removed. -
The
initialize
method inDiffusionGatewayFramework
has been renamed tostart
and now returns an instance ofGatewayFramework
. This method both initializes and starts the application. -
The
shutdown
method of theGatewayFramework
interface has been removed. This has been added as a static method inDiffusionGatewayFramework
. -
Setting
topicType
inSinkServiceProperties.Builder
has been removed, as setting a topic type for Diffusion topic subscription is not required anymore. -
Setting
consumeJSONSubTypes
inSinkServiceProperties.Builder
has been removed. -
The
addSink
method inGatewayApplication
has been updated to passSubscriber
instance. -
The
addHybrid
method inGatewayApplication
has also been updated to passSubscriber
instance. -
The option to set the
basePath
parameter in thetopicProperties
for the framework configuration of the source service has been removed. -
The
getGatewayMeterRegistry
method has been renamed toinitializeGatewayMeterRegistry
, which takes a map of global application configuration to initialize the instance ofMeterRegistry
. -
The reportStatus method in the StateHandler is updated to return a CompletableFuture containing the state of the service once the service has completed the state change following a pause or resume based on the supplied status.
For additional details, please refer to the Gateway Framework API Javadoc.
When upgrading the Gateway Framework from version 1.x to 2.x, follow these steps:
-
Fix the compile errors as defined above.
-
Remove the
META-INF/services
folder in resources (if available), as Payload converter instantiation using the Java Service Provider Interface (SPI) mechanism is removed in this release.
Note: The Gateway Framework 2.0 requires the Diffusion server to have a maximum message size configured to be larger than 32k. Therefore, the server needs to be configured with a larger message size limit. Alternatively, you can use a Diffusion server version later than 6.10.0, whose max-message-size
is set to 256k
by default. To configure the server, update the etc/Server.xml
file to contain:
<max-message-size>256k</max-message-size>