JBOSS AppServer 和客户端之间通过多播进行通信
我是 JBOSS 的新手。我正在尝试编写一个 mBean,它将使用 JGroups 在 AS 内部通过多播通道进行通信。我在 mBean 中使用的代码如下...
public void create() throws Exception {
channel=new JChannel("test/udp.xml");
channel.connect("ChatCluster");
}
public void sendMsg() throws ChannelNotConnectedException,
ChannelClosedException {
channel.send(new org.jgroups.Message(
null,null, "hello from the server!"));
}
我还创建了一个正在侦听通道的客户端,但两者没有进行通信.. 这是通道的 XML ..
<UDP
mcast_port="45700"
mcast_addr="224.0.0.11"
tos="8"
ucast_recv_buf_size="20000000"
ucast_send_buf_size="640000"
mcast_recv_buf_size="25000000"
mcast_send_buf_size="640000"
loopback="true"
discard_incompatible_packets="true"
max_bundle_size="64000"
max_bundle_timeout="30"
ip_ttl="${jgroups.udp.ip_ttl:32}"
enable_bundling="true"
enable_diagnostics="true"
thread_naming_pattern="cl"
thread_pool.enabled="true"
thread_pool.min_threads="2"
thread_pool.max_threads="8"
thread_pool.keep_alive_time="5000"
thread_pool.queue_enabled="true"
thread_pool.queue_max_size="10000"
thread_pool.rejection_policy="discard"
oob_thread_pool.enabled="true"
oob_thread_pool.min_threads="1"
oob_thread_pool.max_threads="8"
oob_thread_pool.keep_alive_time="5000"
oob_thread_pool.queue_enabled="false"
oob_thread_pool.queue_max_size="100"
oob_thread_pool.rejection_policy="Run"/>
任何帮助都会非常有用很感激,因为我在这方面花了一些领带,并正在努力解决这个问题。我更愿意使用其他一些机制进行通信,但是我仅限于使用多播......长话短说......
谢谢!
~博尔特
I am new to JBOSS. I am trying to write an mBean that will communicate from within the AS across a multicast channel using JGroups. The code I'm using in my mBean is below...
public void create() throws Exception {
channel=new JChannel("test/udp.xml");
channel.connect("ChatCluster");
}
public void sendMsg() throws ChannelNotConnectedException,
ChannelClosedException {
channel.send(new org.jgroups.Message(
null,null, "hello from the server!"));
}
I also created a client that is listening on the channel, but the two are not communicating .. Here is the XML for the channel ..
<UDP
mcast_port="45700"
mcast_addr="224.0.0.11"
tos="8"
ucast_recv_buf_size="20000000"
ucast_send_buf_size="640000"
mcast_recv_buf_size="25000000"
mcast_send_buf_size="640000"
loopback="true"
discard_incompatible_packets="true"
max_bundle_size="64000"
max_bundle_timeout="30"
ip_ttl="${jgroups.udp.ip_ttl:32}"
enable_bundling="true"
enable_diagnostics="true"
thread_naming_pattern="cl"
thread_pool.enabled="true"
thread_pool.min_threads="2"
thread_pool.max_threads="8"
thread_pool.keep_alive_time="5000"
thread_pool.queue_enabled="true"
thread_pool.queue_max_size="10000"
thread_pool.rejection_policy="discard"
oob_thread_pool.enabled="true"
oob_thread_pool.min_threads="1"
oob_thread_pool.max_threads="8"
oob_thread_pool.keep_alive_time="5000"
oob_thread_pool.queue_enabled="false"
oob_thread_pool.queue_max_size="100"
oob_thread_pool.rejection_policy="Run"/>
Any help would be greatly appreciated as I have spent some tie on this and am trying to figure this out. I would prefer to use some other echanism for communication, however I am limited to just using multicast ... long story..
Thanks!!!
~Bolt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的网络是否设置为多播? JGroups 文档有几个相关的指针。东西不起作用,还有一些测试程序。请参阅安装指南,第 2.6 节。如果您的网络正常,那么这个简单的
程序应该可以开箱即用。如果是这种情况,我会采用已知良好的 JGroups 配置,并用它配置您的系统,然后从那里开始工作。
Is your network set up for multicast ? The JGroups documentation has several pointers re. stuff not working, and some test programs. See the Installation Guide, section 2.6 on. If your network is ok, then the simple
program should work out of the box. If that is the case, I would take a known-to-be-good JGroups configuration, and configure your system with that, and work from there.
原来我的系统上有多个网卡,所以我设置了标志 receive_on_all_interfaces="true"。
It turned out that I had multiple NIC cards on my system, so I set the flag receive_on_all_interfaces="true".