Class 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BROKER_NOT_AVAILABLE  
      • Fields inherited from class org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler

        logger
      • Fields inherited from interface org.springframework.context.SmartLifecycle

        DEFAULT_PHASE
    • 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
      int getBufferCount()  
      long getBufferTimeSpanMs()  
      GraphQLBrokerSubscriptionRegistry getGraphQLsubscriptionRegistry()  
      org.springframework.messaging.support.MessageHeaderInitializer getHeaderInitializer()
      Return the configured header initializer.
      long[] getHeartbeatValue()
      The configured value for the heart-beat settings.
      org.springframework.scheduling.TaskScheduler getTaskScheduler()
      Return the configured TaskScheduler.
      protected void handleConnectionInitMessage​(org.springframework.messaging.Message<org.activiti.cloud.services.notifications.graphql.ws.api.GraphQLMessage> message)  
      protected void handleConnectionTerminate​(org.springframework.messaging.Message<org.activiti.cloud.services.notifications.graphql.ws.api.GraphQLMessage> message)  
      protected void handleMessageInternal​(org.springframework.messaging.Message<?> message)  
      protected void handleStartSubscription​(org.springframework.messaging.Message<org.activiti.cloud.services.notifications.graphql.ws.api.GraphQLMessage> message)  
      protected void handleStopSubscription​(org.springframework.messaging.Message<org.activiti.cloud.services.notifications.graphql.ws.api.GraphQLMessage> message)  
      boolean isBrokerAvailable()
      Whether the message broker is currently available and able to process messages.
      void on​(org.springframework.messaging.simp.broker.BrokerAvailabilityEvent event)  
      GraphQLBrokerMessageHandler setBufferCount​(int bufferCount)  
      GraphQLBrokerMessageHandler setBufferTimeSpanMs​(long bufferTimeSpanMs)  
      void setHeaderInitializer​(org.springframework.messaging.support.MessageHeaderInitializer headerInitializer)
      Configure a MessageHeaderInitializer to apply to the headers of all messages sent to the client outbound channel.
      GraphQLBrokerMessageHandler setHeartbeatValue​(long[] heartbeat)
      Configure the value for the heart-beat settings.
      GraphQLBrokerMessageHandler setTaskScheduler​(org.springframework.scheduling.TaskScheduler taskScheduler)
      Configure the TaskScheduler to use for providing heartbeat support.
      protected void startInternal()  
      protected void stopInternal()  
      • 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, start, stop, stop
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.springframework.context.SmartLifecycle

        getPhase
    • Field Detail

      • BROKER_NOT_AVAILABLE

        public static final java.lang.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

      • getBufferTimeSpanMs

        public long getBufferTimeSpanMs()
      • getBufferCount

        public int getBufferCount()
      • 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&lt;BrokerAvailabilityEvent&gt; to receive notifications when broker becomes available and unavailable.

        Overrides:
        isBrokerAvailable in class org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler
      • startInternal

        protected void startInternal()
        Overrides:
        startInternal in class org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler
      • stopInternal

        protected void stopInternal()
        Overrides:
        stopInternal in class org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler
      • handleMessageInternal

        protected void handleMessageInternal​(org.springframework.messaging.Message<?> message)
        Specified by:
        handleMessageInternal in class org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler
      • handleConnectionInitMessage

        @Timed
        protected final void handleConnectionInitMessage​(org.springframework.messaging.Message<org.activiti.cloud.services.notifications.graphql.ws.api.GraphQLMessage> message)
      • handleStartSubscription

        @Timed
        protected final void handleStartSubscription​(org.springframework.messaging.Message<org.activiti.cloud.services.notifications.graphql.ws.api.GraphQLMessage> message)
      • handleStopSubscription

        @Timed
        protected final void handleStopSubscription​(org.springframework.messaging.Message<org.activiti.cloud.services.notifications.graphql.ws.api.GraphQLMessage> message)
      • handleConnectionTerminate

        @Timed
        protected final void handleConnectionTerminate​(org.springframework.messaging.Message<org.activiti.cloud.services.notifications.graphql.ws.api.GraphQLMessage> message)
      • setTaskScheduler

        public GraphQLBrokerMessageHandler setTaskScheduler​(org.springframework.scheduling.TaskScheduler taskScheduler)
        Configure the TaskScheduler to use for providing heartbeat support. Setting this property also sets the heartbeatValue to "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 taskScheduler in 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 a MessageHeaderInitializer to 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.