public class CamelContextController extends Object implements Runnable
The CamelContextController opens a server socket port and receives control commands from the port. It controls the CamelContext according to the commands received. Its runtime logging information are sent to commons-logging.
CamelContextController打开一个服务端口并且从这个端口接收控制命令,根据获得的命令, 对所包装的CamelContext进行控制。 它的运行时log信息被送给commons-logging。
Modifier and Type | Field and Description |
---|---|
protected BlockingQueue<String> |
commandQueue
The queue for control commands.
|
protected org.apache.camel.CamelContext |
context
The CamelContext that the CamelContextController controls.
|
protected org.apache.camel.impl.DefaultCamelContext |
myContext
The CamelContext that hosts the CamelContextController.
|
Constructor and Description |
---|
CamelContextController(org.apache.camel.CamelContext camelContext,
String serverUri)
Creates an instance which wraps a specified CamelContext,
listens at a specified port and controls the CamelContext according to
commands received from that port.
创建一个实例,它包装指定的某个CamelContext,在指定的端口上监听, 并根据接受到的命令对包装的CamelContext进行控制。 |
CamelContextController(org.apache.camel.CamelContext camelContext,
String serverUri,
boolean autoDisconnect)
Creates an instance which wraps a specified CamelContext,
listens at a specified port and controls the CamelContext according to
commands received from that port.
创建一个实例,它包装指定的某个CamelContext,在指定的端口上监听, 并根据接受到的命令对包装的CamelContext进行控制。 |
Modifier and Type | Method and Description |
---|---|
String |
command(String cmd)
Sends command to the control command queue.
向待处理的控制命令队列中发送一个命令。 |
void |
run()
Starts the command processing loop, exit until "exit" command was received.
循环处理控制命令,直到收到“exit”命令。 |
void |
start()
Starts the CamelContext and the CamelContextController.
启动CamelContext及CamelContextController。 |
protected org.apache.camel.impl.DefaultCamelContext myContext
protected org.apache.camel.CamelContext context
protected BlockingQueue<String> commandQueue
public CamelContextController(org.apache.camel.CamelContext camelContext, String serverUri, boolean autoDisconnect) throws Exception
camelContext
- The CamelContext that will be controlled.serverUri
- The listening port in Camel Netty URI format, for example: tcp://localhost:99999?keepAlive=true
autoDisconnect
- Whether disconnect the socket connection from server side after each control command was received.Exception
public CamelContextController(org.apache.camel.CamelContext camelContext, String serverUri) throws Exception
The socket connection will be disconnected from server side after each command
is received from client side.
每当从客户端接收到一个命令,服务器端就会自动断开socket连接。
camelContext
- The CamelContext that will be controlled.serverUri
- The listening port in Camel Netty URI format, for example: tcp://localhost:99999?keepAlive=true
Exception
public String command(String cmd)
Usually this method should not be called from external directly, commands should be sent to the listening port instead.
一般不从外部直接调用这个方法,而是向监听端口发送命令。
cmd
- Control commands, for example, start, stop, suspend, resume, and status.public void run()
public void start()
They will not exit until the "exit" command was received by CamelContextController.
它们直到收到exit命令才一起退出。
Copyright © 2014. All Rights Reserved.