Class KplMessageHandler
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
io.awspring.cloud.kinesis.integration.KplMessageHandler
- All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>,Aware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,ApplicationContextAware,Lifecycle,Ordered,org.springframework.integration.context.ComponentSourceAware,org.springframework.integration.context.ExpressionCapable,org.springframework.integration.context.Orderable,org.springframework.integration.core.MessageProducer,org.springframework.integration.handler.HeaderPropagationAware,org.springframework.integration.IntegrationPattern,org.springframework.integration.support.context.NamedComponent,org.springframework.integration.support.management.IntegrationManagement,org.springframework.integration.support.management.TrackableComponent,MessageHandler,reactor.core.CoreSubscriber<Message<?>>
public class KplMessageHandler
extends org.springframework.integration.handler.AbstractMessageProducingHandler
implements Lifecycle
The
AbstractMessageHandler implementation for the Amazon Kinesis Producer Library putRecord(s).
The KplBackpressureException is thrown when backpressure handling is enabled and buffer is at max capacity.
This exception can be handled with
AbstractRequestHandlerAdvice.
- Since:
- 4.0
- Author:
- Arnaud Lecollaire, Artem Bilan, Siddharth Jain
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
messagingTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionKplMessageHandler(software.amazon.kinesis.producer.KinesisProducer kinesisProducer) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidhandleMessageInternal(Message<?> message) booleanprotected voidonInit()voidsetBackPressureThreshold(long backPressureThreshold) Configure maximum records in flight for handling backpressure.voidsetEmbeddedHeadersMapper(org.springframework.integration.mapping.OutboundMessageMapper<byte[]> embeddedHeadersMapper) Specify aOutboundMessageMapperfor embedding message headers into the record data together with payload.voidsetExplicitHashKey(String explicitHashKey) voidsetExplicitHashKeyExpression(Expression explicitHashKeyExpression) voidsetExplicitHashKeyExpressionString(String explicitHashKeyExpression) voidsetFlushDuration(Duration flushDuration) Configure aDurationhow often to call aKinesisProducer.flush().voidsetGlueSchema(com.amazonaws.services.schemaregistry.common.Schema glueSchema) Set aSchemato add into aUserRecordbuilt from the request message.voidsetGlueSchemaExpression(Expression glueSchemaExpression) Set a SpEL expression forSchemato add into aUserRecordbuilt from the request message.voidsetGlueSchemaExpressionString(String glueSchemaExpression) Set a SpEL expression forSchemato add into aUserRecordbuilt from the request message.voidsetMessageConverter(MessageConverter messageConverter) Configure aMessageConverterfor converting payload tobyte[]for Kinesis record.voidsetPartitionKey(String partitionKey) voidsetPartitionKeyExpression(Expression partitionKeyExpression) voidsetPartitionKeyExpressionString(String partitionKeyExpression) voidsetSendTimeout(long sendTimeout) voidsetSendTimeoutExpression(Expression sendTimeoutExpression) voidsetSendTimeoutExpressionString(String sendTimeoutExpression) voidvoidsetStreamExpression(Expression streamExpression) voidsetStreamExpressionString(String streamExpression) voidstart()voidstop()Methods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setupMessageProcessor, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeadersMethods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getComponentType, getIntegrationPatternType, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface reactor.core.CoreSubscriber
currentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
KplMessageHandler
public KplMessageHandler(software.amazon.kinesis.producer.KinesisProducer kinesisProducer)
-
-
Method Details
-
setBackPressureThreshold
public void setBackPressureThreshold(long backPressureThreshold) Configure maximum records in flight for handling backpressure. By default, backpressure handling is not enabled. When backpressure handling is enabled and number of records in flight exceeds the threshold, aKplBackpressureExceptionwould be thrown.- Parameters:
backPressureThreshold- a value greater than0to enable backpressure handling.
-
setMessageConverter
Configure aMessageConverterfor converting payload tobyte[]for Kinesis record.- Parameters:
messageConverter- theMessageConverterto use.
-
setStream
-
setStreamExpressionString
-
setStreamExpression
-
setPartitionKey
-
setPartitionKeyExpressionString
-
setPartitionKeyExpression
-
setExplicitHashKey
-
setExplicitHashKeyExpressionString
-
setExplicitHashKeyExpression
-
setEmbeddedHeadersMapper
public void setEmbeddedHeadersMapper(org.springframework.integration.mapping.OutboundMessageMapper<byte[]> embeddedHeadersMapper) Specify aOutboundMessageMapperfor embedding message headers into the record data together with payload.- Parameters:
embeddedHeadersMapper- theOutboundMessageMapperto embed headers into the record data.
-
setFlushDuration
-
setGlueSchema
public void setGlueSchema(com.amazonaws.services.schemaregistry.common.Schema glueSchema) Set aSchemato add into aUserRecordbuilt from the request message.- Parameters:
glueSchema- theSchemato add into aUserRecord.- See Also:
-
setGlueSchemaExpressionString
Set a SpEL expression forSchemato add into aUserRecordbuilt from the request message.- Parameters:
glueSchemaExpression- the SpEL expression to evaluate aSchema.- See Also:
-
setGlueSchemaExpression
Set a SpEL expression forSchemato add into aUserRecordbuilt from the request message.- Parameters:
glueSchemaExpression- the SpEL expression to evaluate aSchema.- See Also:
-
setSendTimeout
public void setSendTimeout(long sendTimeout) - Overrides:
setSendTimeoutin classorg.springframework.integration.handler.AbstractMessageProducingHandler
-
setSendTimeoutExpressionString
-
setSendTimeoutExpression
-
onInit
protected void onInit()- Overrides:
onInitin classorg.springframework.integration.handler.AbstractMessageProducingHandler
-
start
-
stop
-
isRunning
-
handleMessageInternal
- Specified by:
handleMessageInternalin classorg.springframework.integration.handler.AbstractMessageHandler
-