More than one channel in BlazeDS

人盡茶涼 提交于 2019-12-06 10:05:24

I'll just summarize what we've been discussing so that other readers might benefit.

Let's look closely at the error message:

Could not register endpoint 'my-amf' because its URL, '/messagebroker/amf', is already used by endpoint 'my-amf2'

It speaks of '/messagebroker/amf' and doesn't mention the part of the URL before this, i.e. the part with the port number. From this we can derive that BlazeDS simply ignores this first part when it ascertains that two endpoints are identical or not. As such http://localhost:7001/dataservice1/messagebroker/amf and http://localhost:7002/dataservice2/messagebroker/amf would be considered identical even though they point to a different instance.

quick fix

A simple fix for this issue would be to simply rename the second endpoint after the last forward slash. For instance http://localhost:7001/dataservice1/messagebroker/amf2 should already do the trick. I don't think there is anything else you need to worry about since the MessageBroker servlet has a mapping with a wildcard after this last slash (/messagebroker/*) which will route any address formatted like this to the right servlet.

but why?

Perhaps you should reconsider why you're trying to do this. The reason that BlazeDS only checks the last part is that the developers probably simply didn't think of the fact that someone would actually try to point an endpoint to a different instance. Furthermore in your setup this other instance already has the same channel definition. You could simply connect to that channel so there is no need for this routing from the first instance. I have no idea what you're trying to achieve so all I can tell you is that you're probably approaching it from the wrong angle.

A bit out of topic but did you consider using GraniteDS? It would give you much better real-time messaging performance/scalability with its support of WebLogic's asynchronous servlets (see here and here). Connecting to two different webapps shouldn't be a problem as well, since the two messaging contexts (channel definitions, etc.) would be saved in separate servlet contexts.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!