You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by CajunDust <pe...@xepos.be> on 2010/11/23 09:42:19 UTC

JMS Bridge with static URL blocks at startup

Hello,

For starters, I have read the documentation (API, FAQ,..) of the site, and I
have even read the book ActiveLMQ in Action (MEAP). It could be that I
misread or did not stumble on information that I need for my problem.

Usecase:
I am trying to set up a "network of brokers", that is to say, one "mobile"
JMS server, located on a limited resources device, and one JMS server at a
office backend.  
The mobile JMS server has to deal with the possibility that network can go
down, or might not be available when it starts.
The mobile JMS server has to forward some of the destinations to the backend
JMS, without ever loosing one message during interruption of network.
Oh, yeah, did I mention limited resources ?  I cannot use any spring bean
configuration either !!! So all has to be done in plain Java code.  (There
is NO explicit documentation (anymore?) about this on site or in the book ).

The connection URL are as follows : 
mobile JMS:  tcp://10.0.0.2:61112
backend JMS:  tcp://10.0.0.1:61111
bridge URL:  static://(tcp://10.0.0.1:61111)

The problem is that when the "mobile" server is started before the "backend"
jms server, or when there is no connection, the server halts at the 
broker.start() method.  If no bridges are configured, or can be reached,
there is no problem. forwarding works like a charm.

Secondly, there is no timeout, even when the suggested parameters are added
to the bridge URL. 

It is very annoying that the "mobile" jms server does not continue to start,
and even does not accept any messages, neither continues after timeout... it
just stalls !

Can anyone give me some hints, solutions or pointers to solve this problem ?
Or should I abandon the bridge solution for "mobile" environments without
fixed network ?


-- 
View this message in context: http://activemq.2283324.n4.nabble.com/JMS-Bridge-with-static-URL-blocks-at-startup-tp3054999p3054999.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: JMS Bridge with static URL blocks at startup

Posted by CajunDust <pe...@xepos.be>.
Hello,

I got a little further in finding some indication what's happening. My best
guess is that there are race conditions...

The problem I have is when I first create and initialize the broker ... some
time passes, and then I start the broker.
IF I immediately start the broker after creating and configuring it, it does
not block ! But nicely tells me that it cannot reach the remote broker
(loops in timeout messages). When I do start the remote broker, it connects
to it.

BUT, now a NEW problem arises.  When a JMS client ( message consumer)
connects too soon to the broker address ( < 2 sec after starting at my
machine), it does not have any connection errors, but it never receives any
messages that are posted !

Situation:

SENDER 1  --->  JMS A  <- topic_x -> JMS B <--- RECEIVER 2   /  receiver 3

flow:
  - JMS A has a NetworkConnector to JMS B  - forwards  topic_x to B
  - JMS A starts prior to JMS B
  - sender 1 starts posting messages on topic_x
  - JMS B starts 
  - immediately connect receiver 2 to B, and listen on topic_x   => no
messages !
  - when, after a couple of seconds, receiver 3 connects on same topic_x, it
DOES see the incoming messages, receiver 2 is still silent !!!

I have found no way to check if 2 can receive any messages (shows no errors,
acts as normal, etc...)

Is this a possible bug ?

I have tried to run an example of their test (as posted in the reply).   It
gives the exact same behaviour :  the receiver 2 does not hear any messages
when it is started too soon after JMS B starts. 

Does anyone has the same problems ?
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/JMS-Bridge-with-static-URL-blocks-at-startup-tp3054999p3056959.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: JMS Bridge with static URL blocks at startup

Posted by CajunDust <pe...@xepos.be>.
Hello,

I got a little further in finding some indication what's happening. My best
guess is that there are race conditions...

The problem I have is when I first create and initialize the broker ... some
time passes, and then I start the broker.
IF I immediately start the broker after creating and configuring it, it does
not block ! But nicely tells me that it cannot reach the remote broker
(loops in timeout messages). When I do start the remote broker, it connects
to it.

BUT, now a NEW problem arises.  When a JMS client ( message consumer)
connects too soon to the broker address ( < 2 sec after starting at my
machine), it does not have any connection errors, but it never receives any
messages that are posted !

Situation:

SENDER 1  --->  JMS A  <- topic_x -> JMS B <--- RECEIVER 2   /  receiver 3

flow:
  - JMS A has a NetworkConnector to JMS B  - forwards  topic_x to B
  - JMS A starts prior to JMS B
  - sender 1 starts posting messages on topic_x
  - JMS B starts 
  - immediately connect receiver 2 to B, and listen on topic_x   => no
messages !
  - when, after a couple of seconds, receiver 3 connects on same topic_x, it
DOES see the incoming messages, receiver 2 is still silent !!!

I have found no way to check if 2 can receive any messages (shows no errors,
acts as normal, etc...)

Is this a possible bug ?

I have tried to run an example of their test (as posted in the reply).   It
gives the exact same behaviour :  the receiver 2 does not hear any messages
when it is started too soon after JMS B starts. 

Does anyone has the same problems ?
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/JMS-Bridge-with-static-URL-blocks-at-startup-tp3054999p3056957.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: JMS Bridge with static URL blocks at startup

Posted by Gary Tully <ga...@gmail.com>.
Instead of a jms bridge, use a network connector from the mobile
broker to the backend broker.
That is started in its own thread so it will not halt the start of a broker.

I think you should raise a jira issue for the jms bridge, it should
operate in the same way w.r.t not blocking a broker start.

There are loads of java code examples in the tests, for example, see:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/FailoverStaticNetworkTest.java?view=log

On 23 November 2010 08:42, CajunDust <pe...@xepos.be> wrote:
>
> Hello,
>
> For starters, I have read the documentation (API, FAQ,..) of the site, and I
> have even read the book ActiveLMQ in Action (MEAP). It could be that I
> misread or did not stumble on information that I need for my problem.
>
> Usecase:
> I am trying to set up a "network of brokers", that is to say, one "mobile"
> JMS server, located on a limited resources device, and one JMS server at a
> office backend.
> The mobile JMS server has to deal with the possibility that network can go
> down, or might not be available when it starts.
> The mobile JMS server has to forward some of the destinations to the backend
> JMS, without ever loosing one message during interruption of network.
> Oh, yeah, did I mention limited resources ?  I cannot use any spring bean
> configuration either !!! So all has to be done in plain Java code.  (There
> is NO explicit documentation (anymore?) about this on site or in the book ).
>
> The connection URL are as follows :
> mobile JMS:  tcp://10.0.0.2:61112
> backend JMS:  tcp://10.0.0.1:61111
> bridge URL:  static://(tcp://10.0.0.1:61111)
>
> The problem is that when the "mobile" server is started before the "backend"
> jms server, or when there is no connection, the server halts at the
> broker.start() method.  If no bridges are configured, or can be reached,
> there is no problem. forwarding works like a charm.
>
> Secondly, there is no timeout, even when the suggested parameters are added
> to the bridge URL.
>
> It is very annoying that the "mobile" jms server does not continue to start,
> and even does not accept any messages, neither continues after timeout... it
> just stalls !
>
> Can anyone give me some hints, solutions or pointers to solve this problem ?
> Or should I abandon the bridge solution for "mobile" environments without
> fixed network ?
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/JMS-Bridge-with-static-URL-blocks-at-startup-tp3054999p3054999.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
http://blog.garytully.com
http://fusesource.com