Class CamelWebSocketHandler
java.lang.Object
org.apache.camel.component.undertow.handlers.CamelWebSocketHandler
- All Implemented Interfaces:
io.undertow.server.HttpHandler
An
HttpHandler that delegates to WebSocketProtocolHandshakeHandler and provides some wiring to
connect UndertowConsumer with UndertowProducer.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleRequest(io.undertow.server.HttpServerExchange exchange) booleansend(Predicate<io.undertow.websockets.core.WebSocketChannel> peerFilter, Object message, int timeout, org.apache.camel.Exchange camelExchange, org.apache.camel.AsyncCallback camelCallback) Send the givenmessageto one or more channels selected using the givenpeerFilterwithin the giventimeoutand report the outcome to the givencamelExchangeandcamelCallback.voidsetConsumer(UndertowConsumer consumer)
-
Constructor Details
-
CamelWebSocketHandler
public CamelWebSocketHandler()
-
-
Method Details
-
handleRequest
- Specified by:
handleRequestin interfaceio.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 givenmessageto one or more channels selected using the givenpeerFilterwithin the giventimeoutand report the outcome to the givencamelExchangeandcamelCallback.- Parameters:
peerFilter- aPredicateto apply to the set of peers obtained viadelegate'sWebSocketProtocolHandshakeHandler.getPeerConnections()message- the message to sendcamelExchange- to notify about the outcomecamelCallback- to notify about the outcometimeout- in milliseconds- Returns:
trueif the execution finished synchronously orfalseotherwise- Throws:
IOException
-
setConsumer
- Parameters:
consumer- theUndertowConsumerto set
-