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.health.HealthCheckAware,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.SuspendableThe 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 voiddoResume()protected voiddoStart()protected voiddoStop()protected voiddoSuspend()UndertowEndpointgetEndpoint()voidhandleRequest(io.undertow.server.HttpServerExchange httpExchange)booleanisRest()booleanisSuspended()voidsendEventNotification(String connectionKey, io.undertow.websockets.spi.WebSocketHttpExchange transportExchange, io.undertow.websockets.core.WebSocketChannel channel, UndertowConstants.EventType eventType)Send a notification related a WebSocket peer.voidsendMessage(String connectionKey, io.undertow.websockets.core.WebSocketChannel channel, Object message)Create anExchangefrom the associatedUndertowEndpointand set theinMessage's body to the givenmessageandUndertowConstants.CONNECTION_KEYheader to the givenconnectionKey.voidsetRest(boolean rest)-
Methods inherited from class org.apache.camel.support.DefaultConsumer
createExchange, createUoW, defaultConsumerCallback, doBuild, doInit, doneUoW, doShutdown, getAsyncProcessor, getExceptionHandler, getHealthCheck, getProcessor, getRoute, getRouteId, handleException, handleException, handleException, releaseExchange, setExceptionHandler, setHealthCheck, setRoute, setRouteId, toString
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doFail, doLifecycleChange, 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:
getEndpointin interfaceorg.apache.camel.EndpointAware- Overrides:
getEndpointin classorg.apache.camel.support.DefaultConsumer
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.DefaultConsumer- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.apache.camel.support.DefaultConsumer- Throws:
Exception
-
doSuspend
protected void doSuspend() throws Exception- Overrides:
doSuspendin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doResume
protected void doResume() throws Exception- Overrides:
doResumein classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
isSuspended
public boolean isSuspended()
- Specified by:
isSuspendedin interfaceorg.apache.camel.SuspendableService- Overrides:
isSuspendedin classorg.apache.camel.support.service.BaseService
-
handleRequest
public void handleRequest(io.undertow.server.HttpServerExchange httpExchange) throws Exception- Specified by:
handleRequestin interfaceio.undertow.server.HttpHandler- Throws:
Exception
-
sendMessage
public void sendMessage(String connectionKey, io.undertow.websockets.core.WebSocketChannel channel, Object message)
Create anExchangefrom the associatedUndertowEndpointand set theinMessage's body to the givenmessageandUndertowConstants.CONNECTION_KEYheader to the givenconnectionKey.- Parameters:
connectionKey- an identifier ofWebSocketChannelthrough which themessagewas receivedchannel- theWebSocketChannelthrough which themessagewas 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- theWebSocketChannelthrough which themessagewas receivedeventType- the type of the event
-
-