140.8. path 和 query 参数
WebSocket 服务器消费者支持配置参数化路径。path 参数值将设置为 Camel Exchange 标头:
from("vertx-websocket:localhost:8080/chat/{user}")
.log("New message from ${header.user} >>> ${body}")
from("vertx-websocket:localhost:8080/chat/{user}")
.log("New message from ${header.user} >>> ${body}")
您还可以检索 WebSocket 客户端用来连接到服务器端点的任何查询参数值:
from("direct:sendChatMessage")
.to("vertx-websocket:localhost:8080/chat/camel?role=admin");
from("vertx-websocket:localhost:8080/chat/{user}")
.log("New message from ${header.user} (${header.role}) >>> ${body}")
from("direct:sendChatMessage")
.to("vertx-websocket:localhost:8080/chat/camel?role=admin");
from("vertx-websocket:localhost:8080/chat/{user}")
.log("New message from ${header.user} (${header.role}) >>> ${body}")