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
    • 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<BrokerAvailabilityEvent> 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<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 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.