Class PostgresSubscribableChannel
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.channel.AbstractSubscribableChannel
org.springframework.integration.jdbc.channel.PostgresSubscribableChannel
- All Implemented Interfaces:
- Aware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- ComponentSourceAware,- ExpressionCapable,- IntegrationPattern,- PostgresChannelMessageTableSubscriber.Subscription,- NamedComponent,- IntegrationManagement,- SubscribableChannelManagement,- TrackableComponent,- MessageChannel,- SubscribableChannel,- InterceptableChannel
public class PostgresSubscribableChannel
extends AbstractSubscribableChannel
implements PostgresChannelMessageTableSubscriber.Subscription
An 
AbstractSubscribableChannel for receiving push notifications for
 messages send to a group id of a JdbcChannelMessageStore. Receiving
 such push notifications is only possible if using a Postgres database.
 
 In order to function, the Postgres database that is used must define a trigger
 for sending notifications upon newly arrived messages. This trigger is defined
 in the schema-postgresql.sql file within this artifact but commented
 out.- Since:
- 6.0
- Author:
- Rafael Winterhalter, Artem Bilan, Igor Lovich, Norbert Schneider
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannelAbstractMessageChannel.ChannelInterceptorListNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.channel.AbstractMessageChannelinterceptors, metersFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.messaging.MessageChannelINDEFINITE_TIMEOUT
- 
Constructor SummaryConstructorsConstructorDescriptionPostgresSubscribableChannel(JdbcChannelMessageStore jdbcChannelMessageStore, Object groupId, PostgresChannelMessageTableSubscriber messageTableSubscriber) Create a subscribable channel for a Postgres database.
- 
Method SummaryModifier and TypeMethodDescriptionprotected booleanSubclasses must implement this method.protected MessageDispatcherReturn the group id for which this subscription receives notifications.Return the region for which this subscription receives notifications.voidIndicate that a message was added to the represented region and group id.protected voidonInit()Subclasses may implement this for initialization logic.voidsetDispatcherExecutor(Executor executor) Set the executor to use for dispatching newly received messages.voidsetErrorHandler(ErrorHandler errorHandler) Set aErrorHandlerfor messages which cannot be dispatched by this channel.voidsetRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate) Set the retry template to use for retries in case of exception in downstream processingvoidsetTransactionManager(PlatformTransactionManager transactionManager) Set the transaction manager to use for message processing.booleansubscribe(MessageHandler handler) booleanunsubscribe(MessageHandler handle) Methods inherited from class org.springframework.integration.channel.AbstractSubscribableChannelgetSubscriberCountMethods inherited from class org.springframework.integration.channel.AbstractMessageChanneladdInterceptor, addInterceptor, destroy, getComponentType, getFullChannelName, getIChannelInterceptorList, getIntegrationPatternType, getInterceptors, getMetricsCaptor, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, removeInterceptor, removeInterceptor, send, send, setDatatypes, setInterceptors, setLoggingEnabled, setMessageConverter, setObservationConvention, setShouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, 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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetManagedName, getManagedType, getThisAs, setManagedName, setManagedTypeMethods inherited from interface org.springframework.messaging.MessageChannelsend, sendMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
PostgresSubscribableChannelpublic PostgresSubscribableChannel(JdbcChannelMessageStore jdbcChannelMessageStore, Object groupId, PostgresChannelMessageTableSubscriber messageTableSubscriber) Create a subscribable channel for a Postgres database.- Parameters:
- jdbcChannelMessageStore- The message store to use for the relevant region.
- groupId- The group id that is targeted by the subscription.
- messageTableSubscriber- The subscriber to use for receiving notifications.
 
 
- 
- 
Method Details- 
setDispatcherExecutorSet the executor to use for dispatching newly received messages.- Parameters:
- executor- The executor to use.
 
- 
setTransactionManagerSet the transaction manager to use for message processing. Each message will be processed in a separate transaction- Parameters:
- transactionManager- The transaction manager to use
- Since:
- 6.0.5
- See Also:
 
- 
setRetryTemplatepublic void setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate) Set the retry template to use for retries in case of exception in downstream processing- Parameters:
- retryTemplate- The retry template to use
- Since:
- 6.0.5
- See Also:
 
- 
setErrorHandlerSet aErrorHandlerfor messages which cannot be dispatched by this channel. Used as a recovery callback afterRetryTemplateexecution throws an exception.- Parameters:
- errorHandler- the- ErrorHandlerto use.
- Since:
- 6.0.9
 
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- AbstractMessageChannel
 
- 
subscribe- Specified by:
- subscribein interface- SubscribableChannel
- Overrides:
- subscribein class- AbstractSubscribableChannel
 
- 
unsubscribe- Specified by:
- unsubscribein interface- SubscribableChannel
- Overrides:
- unsubscribein class- AbstractSubscribableChannel
 
- 
getDispatcher- Specified by:
- getDispatcherin class- AbstractSubscribableChannel
 
- 
doSendDescription copied from class:AbstractMessageChannelSubclasses must implement this method. A non-negative timeout indicates how long to wait if the channel is at capacity (if the value is 0, it must return immediately with or without success). A negative timeout value indicates that the method should block until either the message is accepted or the blocking thread is interrupted.- Overrides:
- doSendin class- AbstractSubscribableChannel
- Parameters:
- message- The message.
- timeout- The timeout.
- Returns:
- true if the sendwas successful.
 
- 
notifyUpdatepublic void notifyUpdate()Description copied from interface:PostgresChannelMessageTableSubscriber.SubscriptionIndicate that a message was added to the represented region and group id. Note that this method might also be invoked if there are no new messages to read, for example, if another subscription already read those messages or if a new message might have arrived during a temporary connection loss.- Specified by:
- notifyUpdatein interface- PostgresChannelMessageTableSubscriber.Subscription
 
- 
getRegionDescription copied from interface:PostgresChannelMessageTableSubscriber.SubscriptionReturn the region for which this subscription receives notifications.- Specified by:
- getRegionin interface- PostgresChannelMessageTableSubscriber.Subscription
- Returns:
- The relevant region of the JdbcChannelMessageStore.
 
- 
getGroupIdDescription copied from interface:PostgresChannelMessageTableSubscriber.SubscriptionReturn the group id for which this subscription receives notifications.- Specified by:
- getGroupIdin interface- PostgresChannelMessageTableSubscriber.Subscription
- Returns:
- The group id of the PostgresSubscribableChannel.
 
 
-