You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by jmorri <je...@boeing.com> on 2007/10/17 19:30:31 UTC

Determine what ports ActiveMQ is listening on

Hi,

I'm trying to write a Java program that will list the protocols and ports
that ActiveMQ is currently listening on.  I've got it set up to examine the
log file and look for the "Listening for connection" lines, and extract it
from that.  That works okay, but it doesn't seem like the most elegant
solution (for example, if the activemq process is started and output isn't
redirected to a log file).

Is there a process that can be run to determine that information, or maybe
even an API call I could use?

I'm sorry if this is too basic of a question to ask here,

Thanks.
-- 
View this message in context: http://www.nabble.com/Determine-what-ports-ActiveMQ-is-listening-on-tf4642072s2354.html#a13258806
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Determine what ports ActiveMQ is listening on

Posted by jmorri <je...@boeing.com>.

bsnyder wrote:
> 
> The BSD netstat -an options should suit the situation just fine. Below
> is a breakdown of the suggested options on LInux netstat:
> 
> -t: tcp
> -u: udp
> -l: listening
> -p: pid
> -e: additional info
> -n: numeric ports
> 
> Bruce
> 

netstat -an doesn't seem to list processes or process ids.
-- 
View this message in context: http://www.nabble.com/Determine-what-ports-ActiveMQ-is-listening-on-tf4642072s2354.html#a13281616
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Determine what ports ActiveMQ is listening on

Posted by Bruce Snyder <br...@gmail.com>.
On 10/18/07, jmorri <je...@boeing.com> wrote:
>
>
> j0llyr0g3r wrote:
> >
> > Hi,
> >
> > if activemq is the only java-process running, you could execute something
> > like:
> >
> >  netstat -tulpen | grep -i java
> >
> > with the processbuilder from within java and then parse the corresponding
> > output (i assume you are using Linux) for the listed ports.
> >
>
> Thanks for the suggestion.  I'm using Solaris, do you know a comparable set
> of flags to -tulpen that would work in Solaris (I'm not familiar with the
> command outside of netstat -an)?

The BSD netstat -an options should suit the situation just fine. Below
is a breakdown of the suggested options on LInux netstat:

-t: tcp
-u: udp
-l: listening
-p: pid
-e: additional info
-n: numeric ports

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/

RE: Determine what ports ActiveMQ is listening on

Posted by "Suchitha Koneru (sukoneru)" <su...@cisco.com>.
The user can configure the broker port in activemq.xml , i.e the port at
which the broker starts. When TCP connecter is used ,in case of  the jms
producers and consumers active mq internally generates ports and we do
not have a control on it.   

-----Original Message-----
From: jmorri [mailto:jeffrey.s.morrison@boeing.com] 
Sent: Thursday, October 18, 2007 12:10 PM
To: users@activemq.apache.org
Subject: RE: Determine what ports ActiveMQ is listening on



Suchitha Koneru (sukoneru) wrote:
> 
> You can run jconsole and connect to the java process .In the  Threads 
> tab , Active MQ threads will be displayed along with the port numbers.
> 

Is there a way to incorporate that into my own code?  I'd like for the
user to be able to see which port and protocol ActiveMQ is listening on,
and to choose over which connection to send messages.  
--
View this message in context:
http://www.nabble.com/Determine-what-ports-ActiveMQ-is-listening-on-tf46
42072s2354.html#a13281552
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

RE: Determine what ports ActiveMQ is listening on

Posted by jmorri <je...@boeing.com>.

Suchitha Koneru (sukoneru) wrote:
> 
> You can run jconsole and connect to the java process .In the  Threads
> tab , Active MQ threads will be displayed along with the port numbers. 
> 

Is there a way to incorporate that into my own code?  I'd like for the user
to be able to see which port and protocol ActiveMQ is listening on, and to
choose over which connection to send messages.  
-- 
View this message in context: http://www.nabble.com/Determine-what-ports-ActiveMQ-is-listening-on-tf4642072s2354.html#a13281552
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


RE: Determine what ports ActiveMQ is listening on

Posted by "Suchitha Koneru (sukoneru)" <su...@cisco.com>.
You can run jconsole and connect to the java process .In the  Threads
tab , Active MQ threads will be displayed along with the port numbers. 

-----Original Message-----
From: jmorri [mailto:jeffrey.s.morrison@boeing.com] 
Sent: Thursday, October 18, 2007 7:11 AM
To: users@activemq.apache.org
Subject: Re: Determine what ports ActiveMQ is listening on



j0llyr0g3r wrote:
> 
> Hi,
> 
> if activemq is the only java-process running, you could execute 
> something
> like:
> 
>  netstat -tulpen | grep -i java
> 
> with the processbuilder from within java and then parse the 
> corresponding output (i assume you are using Linux) for the listed
ports.
> 

Thanks for the suggestion.  I'm using Solaris, do you know a comparable
set of flags to -tulpen that would work in Solaris (I'm not familiar
with the command outside of netstat -an)?

netstat: illegal option -- t
usage: netstat [-anv] [-f address_family]
       netstat [-g | -p | -s] [-n] [-f address_family] [-P protocol]
       netstat -m
       netstat -i [-I interface] [-an] [-f address_family] [interval]
       netstat -r [-anv] [-f address_family]
       netstat -M [-ns] [-f address_family]
       netstat -D [-I interface] [-f address_family]
--
View this message in context:
http://www.nabble.com/Determine-what-ports-ActiveMQ-is-listening-on-tf46
42072s2354.html#a13275339
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Determine what ports ActiveMQ is listening on

Posted by jmorri <je...@boeing.com>.

j0llyr0g3r wrote:
> 
> Hi,
> 
> if activemq is the only java-process running, you could execute something
> like:
> 
>  netstat -tulpen | grep -i java
> 
> with the processbuilder from within java and then parse the corresponding
> output (i assume you are using Linux) for the listed ports.
> 

Thanks for the suggestion.  I'm using Solaris, do you know a comparable set
of flags to -tulpen that would work in Solaris (I'm not familiar with the
command outside of netstat -an)?

netstat: illegal option -- t
usage: netstat [-anv] [-f address_family]
       netstat [-g | -p | -s] [-n] [-f address_family] [-P protocol]
       netstat -m
       netstat -i [-I interface] [-an] [-f address_family] [interval]
       netstat -r [-anv] [-f address_family]
       netstat -M [-ns] [-f address_family]
       netstat -D [-I interface] [-f address_family]
-- 
View this message in context: http://www.nabble.com/Determine-what-ports-ActiveMQ-is-listening-on-tf4642072s2354.html#a13275339
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Determine what ports ActiveMQ is listening on

Posted by j0llyr0g3r <ti...@wincor-nixdorf.com>.
Hi,

if activemq is the only java-process running, you could execute something
like:

 netstat -tulpen | grep -i java

with the processbuilder from within java and then parse the corresponding
output (i assume you are using Linux) for the listed ports.


jmorri wrote:
> 
> Hi,
> 
> I'm trying to write a Java program that will list the protocols and ports
> that ActiveMQ is currently listening on.  I've got it set up to examine
> the log file and look for the "Listening for connection" lines, and
> extract it from that.  That works okay, but it doesn't seem like the most
> elegant solution (for example, if the activemq process is started and
> output isn't redirected to a log file).
> 
> Is there a process that can be run to determine that information, or maybe
> even an API call I could use?
> 
> I'm sorry if this is too basic of a question to ask here,
> 
> Thanks.
> 

-- 
View this message in context: http://www.nabble.com/Determine-what-ports-ActiveMQ-is-listening-on-tf4642072s2354.html#a13275182
Sent from the ActiveMQ - User mailing list archive at Nabble.com.