358.10. WildFly 上的 Undertow使用者
WildFly 上的 camel-undertow 消费者的配置与独立的 Camel 不同。制作者端点可以正常工作。
在 WildFly 上,camel-undertow 使用者利用容器提供的默认 Undertow HTTP 服务器。服务器在 undertow 子系统配置中定义。以下是 standalone.xml 中默认配置的摘录:
<subsystem xmlns="urn:jboss:domain:undertow:4.0"> <buffer-cache name="default" /> <server name="default-server"> <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true" /> <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true" /> <host name="default-host" alias="localhost"> <location name="/" handler="welcome-content" /> <filter-ref name="server-header" /> <filter-ref name="x-powered-by-header" /> <http-invoker security-realm="ApplicationRealm" /> </host> </server> </subsystem>
在本例中,Undertow 配置为侦听由 http 和 https socket-binding 指定的接口/端口。默认情况下,这是 https 和 8443 的端口 8080。
这有以下影响:
- Camel-undertow 用户仅绑定到 localhost:8080 或 localhost:8443
- 有些端点消费者配置选项没有影响(请参阅以下),因为这些设置由 WildFly 容器管理
例如,如果您使用不同的主机或端口组合配置端点使用者,服务器日志文件中将显示一个警告。例如,会忽略以下主机和端口配置:
from("undertow:http://somehost:1234/path/to/resource")
[org.wildfly.extension.camel] (pool-2-thread-1) Ignoring configured host: http://somehost:1234/path/to/resource
但是,使用者仍可在默认主机和端口 localhost:8080 或 localhost:8443 上可用。
358.10.1. 配置备用端口
如果需要接受其他端口,则必须通过 WildFly 子系统配置来配置这些端口。这在服务器文档中阐述: