Class CamelWebSocketHandler

java.lang.Object
org.apache.camel.component.undertow.handlers.CamelWebSocketHandler
All Implemented Interfaces:
io.undertow.server.HttpHandler

public class CamelWebSocketHandler extends Object implements io.undertow.server.HttpHandler
An HttpHandler that delegates to WebSocketProtocolHandshakeHandler and provides some wiring to connect UndertowConsumer with UndertowProducer.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handleRequest(io.undertow.server.HttpServerExchange exchange)
    boolean
    send(Predicate<io.undertow.websockets.core.WebSocketChannel> peerFilter, Object message, int timeout, org.apache.camel.Exchange camelExchange, org.apache.camel.AsyncCallback camelCallback)
    Send the given message to one or more channels selected using the given peerFilter within the given timeout and report the outcome to the given camelExchange and camelCallback.
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CamelWebSocketHandler

      public CamelWebSocketHandler()
  • Method Details

    • handleRequest

      public void handleRequest(io.undertow.server.HttpServerExchange exchange) throws Exception
      Specified by:
      handleRequest in interface io.undertow.server.HttpHandler
      Throws:
      Exception
    • send

      public boolean send(Predicate<io.undertow.websockets.core.WebSocketChannel> peerFilter, Object message, int timeout, org.apache.camel.Exchange camelExchange, org.apache.camel.AsyncCallback camelCallback) throws IOException
      Send the given message to one or more channels selected using the given peerFilter within the given timeout and report the outcome to the given camelExchange and camelCallback.
      Parameters:
      peerFilter - a Predicate to apply to the set of peers obtained via delegate's WebSocketProtocolHandshakeHandler.getPeerConnections()
      message - the message to send
      timeout - in milliseconds
      camelExchange - to notify about the outcome
      camelCallback - to notify about the outcome
      Returns:
      true if the execution finished synchronously or false otherwise
      Throws:
      IOException
    • setConsumer

      public void setConsumer(UndertowConsumer consumer)
      Parameters:
      consumer - the UndertowConsumer to set