我正在将 CometD 与 Tomcat 一起使用。我尝试让 Oort 运行,但似乎 2 个 OORT 节点之间的通知存在一些问题。
我尝试了静态但切换到 MultiCastConfigServlet 以确保我没有犯任何愚蠢的配置错误。
web.xml 设置如下:
<servlet>
<servlet-name>cometd</servlet-name>
<servlet-class>org.cometd.server.CometdServlet</servlet-class>
<init-param>
<param-name>transports</param-name>
<param-value>org.cometd.server.transport.JSONTransport</param-value>
</init-param>
<init-param>
<param-name>allowedTransports</param-name>
<param-value>JSONTransport</param-value>
</init-param>
<init-param>
<param-name>timeout</param-name>
<param-value>10000</param-value>
</init-param>
<init-param>
<param-name>jsonContext</param-name>
<param-value>org.cometd.server.JacksonJSONContextServer</param-value>
</init-param>
<init-param>
<param-name>maxInterval</param-name>
<param-value>10000</param-value>
</init-param>
<init-param>
<param-name>long-polling.multiSessionInterval</param-name>
<param-value>2000</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>cometd</servlet-name>
<url-pattern>/cometd/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>oort</servlet-name>
<servlet-class>org.cometd.oort.OortMulticastConfigServlet</servlet-class>
<load-on-startup>2</load-on-startup>
<init-param>
<param-name>oort.url</param-name>
<param-value>http://localhost:8080/context/cometd</param-value>
</init-param>
<init-param>
<param-name>oort.channels</param-name>
<param-value>/appchannel/**,/seti/**</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>Seti</servlet-name>
<servlet-class>org.cometd.oort.SetiServlet</servlet-class>
<load-on-startup>3</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet>
<servlet-name>initializer</servlet-name>
<servlet- class>com.company.server.bayeux.BayeuxInitializerServlet</servlet-class>
<load-on-startup>4</load-on-startup>
<async-supported>true</async-supported>
</servlet>
我使用 seti 将用户与会话相关联。此关联必须通过 oort 与所有 oort 节点同步。
在我看来,如果一个新的 OOrt 节点起作用,则应该触发 Oort.CometListener cometJoined()。但是这个监听器方法永远不会被调用。
我不确定这是tomcat问题还是程序错误。