You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Venkatg <ve...@yahoo.com> on 2006/07/27 14:13:19 UTC
broker static dynamic IP list
Hi,
I have read most the of posts related to static brokers but I couldn't
find the solution for my problem.
My requirement, I have a embedded broker BE(back end) and publisher
running on some machine and when ever an embedded FE broker(Front end)
started it should connect to BE broker get the messages then onwards. FE
broker knows the IPaddress of the BE broker. There can more than one FE
broker running at any point of time. But I don't know the IP addresses of FE
brokers before starting the BE server and also they can in different
subnets. So I can't give hard list of URI for networkConnector static list
on BE.
Please let me know how can I solve the above problem
Thanks
Venkat
--
View this message in context: http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5519815
Sent from the ActiveMQ - User forum at Nabble.com.
Re: broker static dynamic IP list
Posted by James Strachan <ja...@gmail.com>.
Does your JVM create any JMS connections? If so what URL are they
using to connect to the broker?
(Note the BrokerService class *is* a broker - so you do have a broker
inside your JVM).
On 7/28/06, Venkatg <ve...@yahoo.com> wrote:
>
> No. it's runs in a single JVM and doesn't span any broker/JVM
>
> Thx
> -Venkat
> --
> View this message in context: http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5538589
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: broker static dynamic IP list
Posted by Venkatg <ve...@yahoo.com>.
No. it's runs in a single JVM and doesn't span any broker/JVM
Thx
-Venkat
--
View this message in context: http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5538589
Sent from the ActiveMQ - User forum at Nabble.com.
Re: broker static dynamic IP list
Posted by James Strachan <ja...@gmail.com>.
Does the JVM start up any other JMS connections using "vm://" before
you start the broker?
On 7/28/06, Venkatg <ve...@yahoo.com> wrote:
>
>
> public class BrokerMain
> {
> public static void main(String[] args)
> {
> final BrokerService broker = new BrokerService();;
> Runnable doRun = new Runnable(){
> public void run()
> {
> try
> {
>
> broker.setBrokerName("FE-Test");
> broker.addConnector(new URI("tcp://localhost:61616"));
> thrdBroker.setBrokerName("BEServer");
> thrdBroker.setPersistent(false);
> thrdBroker.setUseJmx(false);
> thrdBroker.start();
> } catch (Exception e)
> {
> e.printStackTrace();
> }
> }
> };
> Thread thrd = new Thread(doRun);
> thrd.start();
> ProducerTool publisher = new ProducerTool();
> while( !broker.isStarted() );
>
> BufferedReader waiter = new BufferedReader(new
> InputStreamReader(System.in));
> String input = null;
> try
> {
> System.out.println("Following Commands are supported");
> System.out.println("Publish Messages => 1");
> System.out.println("Add N/W Connector => 2");
> System.out.println("Stop Broker => 3");
> int opCode = -1;
> boolean isStopped = false;
> while( !isStopped && ( input = waiter.readLine()) != null )
> {
> opCode = Integer.parseInt(input);
> switch( opCode )
> {
> case 1:
> {
> ProducerTool.runTool( args, publisher);
> }
> break;
> case 2:
> {
> System.out.println("Enter Broker IPAddress and
> Port (Ex:10.10.8.212:6333) :");
> String ipAddress = waiter.readLine();
> if( ipAddress != null && ipAddress.length() > 0
> )
> {
>
> broker.addNetworkConnector("static:(tcp://"+ipAddress+")");
> }
> }
> break;
> case 3:
> {
> isStopped = true;
> }
> break;
> default:
> }
>
> }
> } catch (IOException e)
> {
> e.printStackTrace();
> } catch (Exception e)
> {
> e.printStackTrace();
> } finally
> {
> try
> {
> broker.stop();
> } catch (Exception e)
> {
> e.printStackTrace();
> }
> }
> }
>
> Thanks
> Venkat
> --
> View this message in context: http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5538264
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: broker static dynamic IP list
Posted by Venkatg <ve...@yahoo.com>.
public class BrokerMain
{
public static void main(String[] args)
{
final BrokerService broker = new BrokerService();;
Runnable doRun = new Runnable(){
public void run()
{
try
{
broker.setBrokerName("FE-Test");
broker.addConnector(new URI("tcp://localhost:61616"));
thrdBroker.setBrokerName("BEServer");
thrdBroker.setPersistent(false);
thrdBroker.setUseJmx(false);
thrdBroker.start();
} catch (Exception e)
{
e.printStackTrace();
}
}
};
Thread thrd = new Thread(doRun);
thrd.start();
ProducerTool publisher = new ProducerTool();
while( !broker.isStarted() );
BufferedReader waiter = new BufferedReader(new
InputStreamReader(System.in));
String input = null;
try
{
System.out.println("Following Commands are supported");
System.out.println("Publish Messages => 1");
System.out.println("Add N/W Connector => 2");
System.out.println("Stop Broker => 3");
int opCode = -1;
boolean isStopped = false;
while( !isStopped && ( input = waiter.readLine()) != null )
{
opCode = Integer.parseInt(input);
switch( opCode )
{
case 1:
{
ProducerTool.runTool( args, publisher);
}
break;
case 2:
{
System.out.println("Enter Broker IPAddress and
Port (Ex:10.10.8.212:6333) :");
String ipAddress = waiter.readLine();
if( ipAddress != null && ipAddress.length() > 0
)
{
broker.addNetworkConnector("static:(tcp://"+ipAddress+")");
}
}
break;
case 3:
{
isStopped = true;
}
break;
default:
}
}
} catch (IOException e)
{
e.printStackTrace();
} catch (Exception e)
{
e.printStackTrace();
} finally
{
try
{
broker.stop();
} catch (Exception e)
{
e.printStackTrace();
}
}
}
Thanks
Venkat
--
View this message in context: http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5538264
Sent from the ActiveMQ - User forum at Nabble.com.
Re: broker static dynamic IP list
Posted by James Strachan <ja...@gmail.com>.
Could you post your Java code you are using to configure and start the
broker service?
On 7/28/06, Venkatg <ve...@yahoo.com> wrote:
>
> Forgot to mention that I have already set the following two properties to
> false.
> broker.setPersistent(false);
> broker.setUseJmx(false);
>
> Still could see following messages in the console
>
> Jul 28, 2006 4:00:16 PM org.apache.activemq.broker.BrokerService getBroker
> INFO: ActiveMQ 4.0.1 JMS Message Broker (localhost) is starting
> Jul 28, 2006 4:00:16 PM org.apache.activemq.broker.BrokerService getBroker
> INFO: For help or more information please see:
> http://incubator.apache.org/activemq/
> Jul 28, 2006 4:00:19 PM
> org.apache.activemq.store.jdbc.JDBCPersistenceAdapter createAdapter
> INFO: Database driver recognized: [apache_derby_embedded_jdbc_driver]
> Jul 28, 2006 4:00:22 PM
> org.apache.activemq.store.journal.JournalPersistenceAdapter recover
> INFO: Journal Recovery Started from: Active Journal: using 2 x 20.0 Megs at:
> D:\Downloads\ActiveMQ\SRC-INT\src\activemq-data\localhost\journal
> Jul 28, 2006 4:00:23 PM
> org.apache.activemq.store.journal.JournalPersistenceAdapter recover
> INFO: Journal Recovered: 1 message(s) in transactions recovered.
> Jul 28, 2006 4:00:24 PM
> org.apache.activemq.transport.TransportServerThreadSupport doStart
> INFO: Listening for connections at: tcp://L3-BFNE3:61616
> Jul 28, 2006 4:00:24 PM org.apache.activemq.broker.TransportConnector start
> INFO: Connector tcp://L3-BFNE3:61616 Started
> Jul 28, 2006 4:00:24 PM org.apache.activemq.broker.BrokerService start
> INFO: ActiveMQ JMS Message Broker (localhost,
> ID:L3-BFNE3-1667-1154082616675-1:0) started
>
> Thanks
> Venkat
> --
> View this message in context: http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5538074
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: broker static dynamic IP list
Posted by Venkatg <ve...@yahoo.com>.
Forgot to mention that I have already set the following two properties to
false.
broker.setPersistent(false);
broker.setUseJmx(false);
Still could see following messages in the console
Jul 28, 2006 4:00:16 PM org.apache.activemq.broker.BrokerService getBroker
INFO: ActiveMQ 4.0.1 JMS Message Broker (localhost) is starting
Jul 28, 2006 4:00:16 PM org.apache.activemq.broker.BrokerService getBroker
INFO: For help or more information please see:
http://incubator.apache.org/activemq/
Jul 28, 2006 4:00:19 PM
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter createAdapter
INFO: Database driver recognized: [apache_derby_embedded_jdbc_driver]
Jul 28, 2006 4:00:22 PM
org.apache.activemq.store.journal.JournalPersistenceAdapter recover
INFO: Journal Recovery Started from: Active Journal: using 2 x 20.0 Megs at:
D:\Downloads\ActiveMQ\SRC-INT\src\activemq-data\localhost\journal
Jul 28, 2006 4:00:23 PM
org.apache.activemq.store.journal.JournalPersistenceAdapter recover
INFO: Journal Recovered: 1 message(s) in transactions recovered.
Jul 28, 2006 4:00:24 PM
org.apache.activemq.transport.TransportServerThreadSupport doStart
INFO: Listening for connections at: tcp://L3-BFNE3:61616
Jul 28, 2006 4:00:24 PM org.apache.activemq.broker.TransportConnector start
INFO: Connector tcp://L3-BFNE3:61616 Started
Jul 28, 2006 4:00:24 PM org.apache.activemq.broker.BrokerService start
INFO: ActiveMQ JMS Message Broker (localhost,
ID:L3-BFNE3-1667-1154082616675-1:0) started
Thanks
Venkat
--
View this message in context: http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5538074
Sent from the ActiveMQ - User forum at Nabble.com.
Re: broker static dynamic IP list
Posted by James Strachan <ja...@gmail.com>.
http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/broker/BrokerService.html#setPersistent(boolean)
On 7/28/06, Venkatg <ve...@yahoo.com> wrote:
>
> Thanks James and Hiram.
> It is wokring perfectly fine now.
>
> In mY application I will be sending only MapMessages/TextMessages and I
> don't require any persistence hence no need to start DB and the driver. Can
> you please let me know how I do disbale these so that when the broker is
> starting it won't try to initialize these things.
>
> Jul 28, 2006 4:00:19 PM
> org.apache.activemq.store.jdbc.JDBCPersistenceAdapter createAdapter
> INFO: Database driver recognized: [apache_derby_embedded_jdbc_driver]
> Jul 28, 2006 4:00:22 PM
> org.apache.activemq.store.journal.JournalPersistenceAdapter recover
> INFO: Journal Recovery Started from: Active Journal: using 2 x 20.0 Megs at:
> D:\Downloads\ActiveMQ\SRC-INT\src\activemq-data\localhost\journal
> Jul 28, 2006 4:00:23 PM
> org.apache.activemq.store.journal.JournalPersistenceAdapter recover
> INFO: Journal Recovered: 1 message(s) in transactions recovered.
>
> Final, How do I divert all log messages appear on the console to my
> application LogServer.
>
> Thanks
> Venkat
> --
> View this message in context: http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5537215
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: broker static dynamic IP list
Posted by Venkatg <ve...@yahoo.com>.
Thanks James and Hiram.
It is wokring perfectly fine now.
In mY application I will be sending only MapMessages/TextMessages and I
don't require any persistence hence no need to start DB and the driver. Can
you please let me know how I do disbale these so that when the broker is
starting it won't try to initialize these things.
Jul 28, 2006 4:00:19 PM
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter createAdapter
INFO: Database driver recognized: [apache_derby_embedded_jdbc_driver]
Jul 28, 2006 4:00:22 PM
org.apache.activemq.store.journal.JournalPersistenceAdapter recover
INFO: Journal Recovery Started from: Active Journal: using 2 x 20.0 Megs at:
D:\Downloads\ActiveMQ\SRC-INT\src\activemq-data\localhost\journal
Jul 28, 2006 4:00:23 PM
org.apache.activemq.store.journal.JournalPersistenceAdapter recover
INFO: Journal Recovered: 1 message(s) in transactions recovered.
Final, How do I divert all log messages appear on the console to my
application LogServer.
Thanks
Venkat
--
View this message in context: http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5537215
Sent from the ActiveMQ - User forum at Nabble.com.
Re: broker static dynamic IP list
Posted by James Strachan <ja...@gmail.com>.
You might wanna change the line to...
broker.addNetworkConnector("static:(tcp://"+ipAddress+")").start();
to start the connector
On 7/28/06, Venkatg <ve...@yahoo.com> wrote:
>
> I have tried the same but I didn't work. The same works fine and forwards the
> message to all the broker If I supply the IP static list before startting
> the BE server. BUt when I add dynamically by calling "addNetworkConnector"
> it didn't work. Do you have any same programs for this case. So I am
> pasting my code
>
> public class BrokerMain
> {
> public static void main(String[] args)
> {
> final BrokerService broker = new BrokerService();;
> Runnable doRun = new Runnable(){
> public void run()
> {
> try
> {
>
> broker.setBrokerName("FE-Test");
> broker.addConnector(new URI("tcp://localhost:61616"));
> thrdBroker.setBrokerName("BEServer");
> thrdBroker.setPersistent(false);
> thrdBroker.setUseJmx(false);
> thrdBroker.start();
> } catch (Exception e)
> {
> e.printStackTrace();
> }
> }
> };
> Thread thrd = new Thread(doRun);
> thrd.start();
> ProducerTool publisher = new ProducerTool();
> while( !broker.isStarted() );
>
> BufferedReader waiter = new BufferedReader(new
> InputStreamReader(System.in));
> String input = null;
> try
> {
> System.out.println("Following Commands are supported");
> System.out.println("Publish Messages => 1");
> System.out.println("Add N/W Connector => 2");
> System.out.println("Stop Broker => 3");
> int opCode = -1;
> boolean isStopped = false;
> while( !isStopped && ( input = waiter.readLine()) != null )
> {
> opCode = Integer.parseInt(input);
> switch( opCode )
> {
> case 1:
> {
> ProducerTool.runTool( args, publisher);
> }
> break;
> case 2:
> {
> System.out.println("Enter Broker IPAddress and
> Port (Ex:10.10.8.212:6333) :");
> String ipAddress = waiter.readLine();
> if( ipAddress != null && ipAddress.length() > 0
> )
> {
>
> broker.addNetworkConnector("static:(tcp://"+ipAddress+")");
> }
> }
> break;
> case 3:
> {
> isStopped = true;
> }
> break;
> default:
> }
>
> }
> } catch (IOException e)
> {
> e.printStackTrace();
> } catch (Exception e)
> {
> e.printStackTrace();
> } finally
> {
> try
> {
> broker.stop();
> } catch (Exception e)
> {
> e.printStackTrace();
> }
> }
> }
> }
> --
> View this message in context: http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5536541
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: broker static dynamic IP list
Posted by Venkatg <ve...@yahoo.com>.
I have tried the same but I didn't work. The same works fine and forwards the
message to all the broker If I supply the IP static list before startting
the BE server. BUt when I add dynamically by calling "addNetworkConnector"
it didn't work. Do you have any same programs for this case. So I am
pasting my code
public class BrokerMain
{
public static void main(String[] args)
{
final BrokerService broker = new BrokerService();;
Runnable doRun = new Runnable(){
public void run()
{
try
{
broker.setBrokerName("FE-Test");
broker.addConnector(new URI("tcp://localhost:61616"));
thrdBroker.setBrokerName("BEServer");
thrdBroker.setPersistent(false);
thrdBroker.setUseJmx(false);
thrdBroker.start();
} catch (Exception e)
{
e.printStackTrace();
}
}
};
Thread thrd = new Thread(doRun);
thrd.start();
ProducerTool publisher = new ProducerTool();
while( !broker.isStarted() );
BufferedReader waiter = new BufferedReader(new
InputStreamReader(System.in));
String input = null;
try
{
System.out.println("Following Commands are supported");
System.out.println("Publish Messages => 1");
System.out.println("Add N/W Connector => 2");
System.out.println("Stop Broker => 3");
int opCode = -1;
boolean isStopped = false;
while( !isStopped && ( input = waiter.readLine()) != null )
{
opCode = Integer.parseInt(input);
switch( opCode )
{
case 1:
{
ProducerTool.runTool( args, publisher);
}
break;
case 2:
{
System.out.println("Enter Broker IPAddress and
Port (Ex:10.10.8.212:6333) :");
String ipAddress = waiter.readLine();
if( ipAddress != null && ipAddress.length() > 0
)
{
broker.addNetworkConnector("static:(tcp://"+ipAddress+")");
}
}
break;
case 3:
{
isStopped = true;
}
break;
default:
}
}
} catch (IOException e)
{
e.printStackTrace();
} catch (Exception e)
{
e.printStackTrace();
} finally
{
try
{
broker.stop();
} catch (Exception e)
{
e.printStackTrace();
}
}
}
}
--
View this message in context: http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5536541
Sent from the ActiveMQ - User forum at Nabble.com.
Re: broker static dynamic IP list
Posted by Hiram Chirino <hi...@hiramchirino.com>.
You can create a Broker using:
broker = BrokerFactory.createBroker(new URI("xbean:activemq.xml"));
broker.start();
And then later pragmatically add connections to other brokers. Notice these
connectors forward messages to the remote host. The remote host would need
to do something similar if it wants to forward connections to this broker.
broker.addNetworkConnector("static:(tcp://remotehost:61616)");
See javadocs:
http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/broker/BrokerFactory.html#createBroker(java.net.URI)
http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/broker/BrokerService.html#addNetworkConnector(java.lang.String)
On 7/27/06, Venkatg <ve...@yahoo.com> wrote:
>
>
> Hi,
>
> I have read most the of posts related to static brokers but I couldn't
> find the solution for my problem.
>
> My requirement, I have a embedded broker BE(back end) and publisher
> running on some machine and when ever an embedded FE broker(Front end)
> started it should connect to BE broker get the messages then onwards. FE
> broker knows the IPaddress of the BE broker. There can more than one FE
> broker running at any point of time. But I don't know the IP addresses of
> FE
> brokers before starting the BE server and also they can in different
> subnets. So I can't give hard list of URI for networkConnector static list
> on BE.
>
> Please let me know how can I solve the above problem
>
> Thanks
> Venkat
> --
> View this message in context:
> http://www.nabble.com/broker-static-dynamic-IP-list-tf2009183.html#a5519815
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
--
Regards,
Hiram
Blog: http://hiramchirino.com