Class UndertowConsumer
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.DefaultConsumer
-
- org.apache.camel.component.undertow.UndertowConsumer
-
- All Implemented Interfaces:
io.undertow.server.HttpHandler
,AutoCloseable
,org.apache.camel.Consumer
,org.apache.camel.EndpointAware
,org.apache.camel.RouteAware
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.RouteIdAware
,org.apache.camel.StatefulService
,org.apache.camel.Suspendable
,org.apache.camel.SuspendableService
public class UndertowConsumer extends org.apache.camel.support.DefaultConsumer implements io.undertow.server.HttpHandler, org.apache.camel.Suspendable
The Undertow consumer which is also an Undertow HttpHandler implementation to handle incoming request.
-
-
Constructor Summary
Constructors Constructor Description UndertowConsumer(UndertowEndpoint endpoint, org.apache.camel.Processor processor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
computeAllowedRoles()
protected void
doResume()
protected void
doStart()
protected void
doStop()
protected void
doSuspend()
UndertowEndpoint
getEndpoint()
void
handleRequest(io.undertow.server.HttpServerExchange httpExchange)
boolean
isRest()
boolean
isSuspended()
void
sendEventNotification(String connectionKey, io.undertow.websockets.spi.WebSocketHttpExchange transportExchange, io.undertow.websockets.core.WebSocketChannel channel, UndertowConstants.EventType eventType)
Send a notification related a WebSocket peer.void
sendMessage(String connectionKey, io.undertow.websockets.core.WebSocketChannel channel, Object message)
Create anExchange
from the associatedUndertowEndpoint
and set thein
Message
's body to the givenmessage
andUndertowConstants.CONNECTION_KEY
header to the givenconnectionKey
.void
setRest(boolean rest)
-
Methods inherited from class org.apache.camel.support.DefaultConsumer
createUoW, doInit, doneUoW, getAsyncProcessor, getExceptionHandler, getProcessor, getRoute, getRouteId, handleException, handleException, setExceptionHandler, setRoute, setRouteId, toString
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doShutdown, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
UndertowConsumer
public UndertowConsumer(UndertowEndpoint endpoint, org.apache.camel.Processor processor)
-
-
Method Detail
-
isRest
public boolean isRest()
-
setRest
public void setRest(boolean rest)
-
getEndpoint
public UndertowEndpoint getEndpoint()
- Specified by:
getEndpoint
in interfaceorg.apache.camel.EndpointAware
- Overrides:
getEndpoint
in classorg.apache.camel.support.DefaultConsumer
-
doStart
protected void doStart() throws Exception
- Overrides:
doStart
in classorg.apache.camel.support.DefaultConsumer
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in classorg.apache.camel.support.DefaultConsumer
- Throws:
Exception
-
doSuspend
protected void doSuspend() throws Exception
- Overrides:
doSuspend
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doResume
protected void doResume() throws Exception
- Overrides:
doResume
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
isSuspended
public boolean isSuspended()
- Specified by:
isSuspended
in interfaceorg.apache.camel.SuspendableService
- Overrides:
isSuspended
in classorg.apache.camel.support.service.BaseService
-
handleRequest
public void handleRequest(io.undertow.server.HttpServerExchange httpExchange) throws Exception
- Specified by:
handleRequest
in interfaceio.undertow.server.HttpHandler
- Throws:
Exception
-
sendMessage
public void sendMessage(String connectionKey, io.undertow.websockets.core.WebSocketChannel channel, Object message)
Create anExchange
from the associatedUndertowEndpoint
and set thein
Message
's body to the givenmessage
andUndertowConstants.CONNECTION_KEY
header to the givenconnectionKey
.- Parameters:
connectionKey
- an identifier ofWebSocketChannel
through which themessage
was receivedchannel
- theWebSocketChannel
through which themessage
was receivedmessage
- the message received via theWebSocketChannel
-
sendEventNotification
public void sendEventNotification(String connectionKey, io.undertow.websockets.spi.WebSocketHttpExchange transportExchange, io.undertow.websockets.core.WebSocketChannel channel, UndertowConstants.EventType eventType)
Send a notification related a WebSocket peer.- Parameters:
connectionKey
- of WebSocket peertransportExchange
- the exchange for the websocket transport, only available for ON_OPEN eventschannel
- theWebSocketChannel
through which themessage
was receivedeventType
- the type of the event
-
-