Class GraphQLBrokerMessageHandler
- java.lang.Object
-
- org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler
-
- org.activiti.cloud.services.notifications.graphql.ws.transport.GraphQLBrokerMessageHandler
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationEventPublisherAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle,org.springframework.messaging.MessageHandler
public class GraphQLBrokerMessageHandler extends org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classGraphQLBrokerMessageHandler.SessionInfo
-
Field Summary
Fields Modifier and Type Field Description static StringBROKER_NOT_AVAILABLE
-
Constructor Summary
Constructors Constructor Description GraphQLBrokerMessageHandler(org.springframework.messaging.SubscribableChannel inboundChannel, org.springframework.messaging.MessageChannel outboundChannel, org.springframework.messaging.SubscribableChannel brokerChannel, GraphQLSubscriptionExecutor graphQLSubscriptionExecutor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBufferCount()longgetBufferTimeSpanMs()GraphQLBrokerSubscriptionRegistrygetGraphQLsubscriptionRegistry()org.springframework.messaging.support.MessageHeaderInitializergetHeaderInitializer()Return the configured header initializer.long[]getHeartbeatValue()The configured value for the heart-beat settings.org.springframework.scheduling.TaskSchedulergetTaskScheduler()Return the configured TaskScheduler.protected voidhandleConnectionInitMessage(org.springframework.messaging.Message<GraphQLMessage> message)protected voidhandleConnectionTerminate(org.springframework.messaging.Message<GraphQLMessage> message)protected voidhandleMessageInternal(org.springframework.messaging.Message<?> message)protected voidhandleStartSubscription(org.springframework.messaging.Message<GraphQLMessage> message)protected voidhandleStopSubscription(org.springframework.messaging.Message<GraphQLMessage> message)booleanisBrokerAvailable()Whether the message broker is currently available and able to process messages.voidon(org.springframework.messaging.simp.broker.BrokerAvailabilityEvent event)GraphQLBrokerMessageHandlersetBufferCount(int bufferCount)GraphQLBrokerMessageHandlersetBufferTimeSpanMs(long bufferTimeSpanMs)voidsetHeaderInitializer(org.springframework.messaging.support.MessageHeaderInitializer headerInitializer)Configure aMessageHeaderInitializerto apply to the headers of all messages sent to the client outbound channel.GraphQLBrokerMessageHandlersetHeartbeatValue(long[] heartbeat)Configure the value for the heart-beat settings.GraphQLBrokerMessageHandlersetTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler)Configure theTaskSchedulerto use for providing heartbeat support.protected voidstartInternal()protected voidstopInternal()-
Methods inherited from class org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler
checkDestinationPrefix, getApplicationEventPublisher, getBrokerChannel, getClientInboundChannel, getClientOutboundChannel, getClientOutboundChannelForSession, getDestinationPrefixes, handleMessage, isAutoStartup, isPreservePublishOrder, isRunning, publishBrokerAvailableEvent, publishBrokerUnavailableEvent, setApplicationEventPublisher, setAutoStartup, setPreservePublishOrder, setUserDestinationPredicate, start, stop, stop
-
-
-
-
Field Detail
-
BROKER_NOT_AVAILABLE
public static final String BROKER_NOT_AVAILABLE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GraphQLBrokerMessageHandler
public GraphQLBrokerMessageHandler(org.springframework.messaging.SubscribableChannel inboundChannel, org.springframework.messaging.MessageChannel outboundChannel, org.springframework.messaging.SubscribableChannel brokerChannel, GraphQLSubscriptionExecutor graphQLSubscriptionExecutor)
-
-
Method Detail
-
getGraphQLsubscriptionRegistry
public GraphQLBrokerSubscriptionRegistry getGraphQLsubscriptionRegistry()
-
getBufferTimeSpanMs
public long getBufferTimeSpanMs()
-
setBufferTimeSpanMs
public GraphQLBrokerMessageHandler setBufferTimeSpanMs(long bufferTimeSpanMs)
-
getBufferCount
public int getBufferCount()
-
setBufferCount
public GraphQLBrokerMessageHandler setBufferCount(int bufferCount)
-
on
@EventListener public void on(org.springframework.messaging.simp.broker.BrokerAvailabilityEvent event)
-
isBrokerAvailable
public boolean isBrokerAvailable()
Whether the message broker is currently available and able to process messages.Note that this is in addition to the
AbstractBrokerMessageHandler.isRunning()flag, which indicates whether this message handler is running. In other words the message handler must first be running and then the#isBrokerAvailable()flag may still independently alternate between being on and off depending on the concrete sub-class implementation.Application components may implement
org.springframework.context.ApplicationListener<BrokerAvailabilityEvent>to receive notifications when broker becomes available and unavailable.- Overrides:
isBrokerAvailablein classorg.springframework.messaging.simp.broker.AbstractBrokerMessageHandler
-
startInternal
protected void startInternal()
- Overrides:
startInternalin classorg.springframework.messaging.simp.broker.AbstractBrokerMessageHandler
-
stopInternal
protected void stopInternal()
- Overrides:
stopInternalin classorg.springframework.messaging.simp.broker.AbstractBrokerMessageHandler
-
handleMessageInternal
protected void handleMessageInternal(org.springframework.messaging.Message<?> message)
- Specified by:
handleMessageInternalin classorg.springframework.messaging.simp.broker.AbstractBrokerMessageHandler
-
handleConnectionInitMessage
@Timed protected final void handleConnectionInitMessage(org.springframework.messaging.Message<GraphQLMessage> message)
-
handleStartSubscription
@Timed protected final void handleStartSubscription(org.springframework.messaging.Message<GraphQLMessage> message)
-
handleStopSubscription
@Timed protected final void handleStopSubscription(org.springframework.messaging.Message<GraphQLMessage> message)
-
handleConnectionTerminate
@Timed protected final void handleConnectionTerminate(org.springframework.messaging.Message<GraphQLMessage> message)
-
setTaskScheduler
public GraphQLBrokerMessageHandler setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler)
Configure theTaskSchedulerto use for providing heartbeat support. Setting this property also sets theheartbeatValueto "10000, 10000".By default this is not set.
-
getTaskScheduler
public org.springframework.scheduling.TaskScheduler getTaskScheduler()
Return the configured TaskScheduler.
-
setHeartbeatValue
public GraphQLBrokerMessageHandler setHeartbeatValue(long[] heartbeat)
Configure the value for the heart-beat settings. The first number represents how often the server will write or send a heartbeat. The second is how often the client should write. 0 means no heartbeats.By default this is set to "0, 0" unless the
taskSchedulerin which case the default becomes "10000,10000" (in milliseconds).
-
getHeartbeatValue
public long[] getHeartbeatValue()
The configured value for the heart-beat settings.
-
setHeaderInitializer
public void setHeaderInitializer(org.springframework.messaging.support.MessageHeaderInitializer headerInitializer)
Configure aMessageHeaderInitializerto apply to the headers of all messages sent to the client outbound channel.By default this property is not set.
-
getHeaderInitializer
public org.springframework.messaging.support.MessageHeaderInitializer getHeaderInitializer()
Return the configured header initializer.
-
-