You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Bögershausen, Merlin" <me...@rwth-aachen.de> on 2023/04/20 10:35:20 UTC

ActiveMQ deployed in server context

Hi ActiveMQ Users,
we use an ActiveMQ deployed on JBoss 7.4 as Messaging Broker for JMS Messages. We have a requirement that the ActiveMQ is reachable under a Context, let’s say ‘jms’ so for example “tcp://localhost:8080/jms”.
We use org.apache.activemq:artemis-jms-client:2.19.1 to connect our Java Application to Artemis with the configuration :
```java
var conectionFactory = new ActiveMQConnectionFactory(“tcp://localhost:8080/jms”);
```
Within the constructor of ActiveMQConnectionFactory the methode ActiveMQConnectionFactory#setBrokerURL is called which forwards “tcp://localhost:8080/jms” to ServerLocatorImpl#newLocator. From here the context ‘jms’ is missing, and the connections are opened against “tcp://localhost:8080/”.

Is there any Build-in way to archive a connection against a context, do we have to implement our own ServerLocator or is it impossible to connect against a context?

Best Merlin

Re: ActiveMQ deployed in server context

Posted by "Bögershausen, Merlin" <me...@rwth-aachen.de>.
Thanks for the pointer. We will try this solution and start searching for a performant solution. But that may take some time __

Best Merlin

Am 20.04.23, 22:41 schrieb "Justin Bertram" <jbertram@apache.org <ma...@apache.org>>:


Generally speaking, what you describe with the proxy sounds perfectly
reasonable if you were working with an HTTP based service. However, the
messaging protocols supported by ActiveMQ Artemis (i.e. core, AMQP, STOMP,
MQTT, & OpenWire) all use bare TCP, and they are stateful. HTTP is a layer
on top of TCP, and it is stateless.


As noted previously, the URL is just a way to configure the client's
connection. The URL's path and parameters are not sent across the wire to
the broker like they would be for a HTTP URL. Typically the only thing that
the client understands about "where" to connect is host and port.


That said, you *can* configure a core client to use HTTP [1] and you can
also configure the "servletPath" URL parameter, e.g.:


tcp://host:port?httpEnabled=true;servletPath=a


I'm not really sure if this would give you the functionality you're looking
for, but I do know that using HTTP isn't ideal from a performance
perspective.




Justin


[1]
https://activemq.apache.org/components/artemis/documentation/latest/configuring-transports.html#configuring-netty-http <https://activemq.apache.org/components/artemis/documentation/latest/configuring-transports.html#configuring-netty-http>


On Thu, Apr 20, 2023 at 11:19 AM Bögershausen, Merlin <
merlin.boegershausen@rwth-aachen.de <ma...@rwth-aachen.de>> wrote:


> Hi Justin,
> thanks for your reply. I know it is TCO and the answer maybe no, that
> never will work. And I am afraid your next message will be exactly this.
> But anyway.
> To clarify: I borrowed "context" from the JavaEE configuration jargon
> where context refers to the URL path under which deployment is accessible.
> Better, or more correctly, would be the term URL-Path.
>
> TL/DR: The URL Path is used to forward our connection to the correct
> server.
>
> Here is our situation, also illustrated in the picture under [1].
> Our customer has a JBoss Application Server with ActiveMQ deployed in
> default configuration as shipped with JBoss 7.4. Let's call this server
> 'as1'.
> Currently our application connects directly to the broker via
> tcp://as1:8080/ and everything works fine.
> Soon our customer implements the new policy that systems must communicate
> over a proxy, let the host be 'proxy'. This proxy will do some stuff like
> authentication and authorization. It works well for all http related stuff.
> It uses the first parts of URL-Path to identify the context and look up how
> to forward and handle the request, let our identification be 'a'.
> To connect via http to as1 via the proxy the correct URL would be
> http://proxy:8080/a which is forwarded to http://as1:8080/, additional
> Parts of the Path will be concatenated so proxy:8080/a/ui -> as1:8080/ui.
>
> Our hope, still, is that it may be possible to use the proxy also for our
> connection to the ActiveMQ. In theory tcp://proxy:8080/a but as you pointed
> out, the protocol doesn't know about paths. Our hope originally came from
> the possibility to attach something which looks like Request-parameter
> behind the '?'.
>
> To state the next question clear, do you see any way that we may use a
> http connection to as1 via proxy for the communication to the ActiveMQ?
>
>
> Best Merlin
> [1]
> https://excalidraw.com/#json=ALhV_uKADGS5mGmParJzs,oE-EEagQFkkJMWndMTFc0A <https://excalidraw.com/#json=ALhV_uKADGS5mGmParJzs,oE-EEagQFkkJMWndMTFc0A>
>
> Am 20.04.23, 16:02 schrieb "Justin Bertram" <jbertram@apache.org <ma...@apache.org> <mailto:
> jbertram@apache.org <ma...@apache.org>>>:
>
>
> I'm not aware of any way to specify a "context" on the client's connection
> URL. Furthermore, I don't how the broker would be configured to handle the
> context and provide different behavior between different contexts.
>
>
> Can you clarify your use-case here? Why exactly do you want/need to use a
> "context" on the client's connection URL? What difference do you want it to
> make when actually connecting to the broker?
>
>
> It's worth noting that the URL here is just a way to configure the client's
> connection. Under the covers the connection is a standard TCP connection. A
> "context" doesn't really have any protocol-level meaning here like it would
> in, for example, HTTP.
>
>
>
>
> Justin
>
>
> On Thu, Apr 20, 2023 at 5:35 AM Bögershausen, Merlin <
> merlin.boegershausen@rwth-aachen.de <ma...@rwth-aachen.de> <mailto:
> merlin.boegershausen@rwth-aachen.de <ma...@rwth-aachen.de>>> wrote:
>
>
> > Hi ActiveMQ Users,
> > we use an ActiveMQ deployed on JBoss 7.4 as Messaging Broker for JMS
> > Messages. We have a requirement that the ActiveMQ is reachable under a
> > Context, let’s say ‘jms’ so for example “tcp://localhost:8080/jms”.
> > We use org.apache.activemq:artemis-jms-client:2.19.1 to connect our Java
> > Application to Artemis with the configuration :
> > ```java
> > var conectionFactory = new
> > ActiveMQConnectionFactory(“tcp://localhost:8080/jms”);
> > ```
> > Within the constructor of ActiveMQConnectionFactory the methode
> > ActiveMQConnectionFactory#setBrokerURL is called which forwards
> > “tcp://localhost:8080/jms” to ServerLocatorImpl#newLocator. From here the
> > context ‘jms’ is missing, and the connections are opened against
> > “tcp://localhost:8080/”.
> >
> > Is there any Build-in way to archive a connection against a context, do
> we
> > have to implement our own ServerLocator or is it impossible to connect
> > against a context?
> >
> > Best Merlin
> >
>
>
>
>




Re: ActiveMQ deployed in server context

Posted by Justin Bertram <jb...@apache.org>.
Generally speaking, what you describe with the proxy sounds perfectly
reasonable if you were working with an HTTP based service. However, the
messaging protocols supported by ActiveMQ Artemis (i.e. core, AMQP, STOMP,
MQTT, & OpenWire) all use bare TCP, and they are stateful. HTTP is a layer
on top of TCP, and it is stateless.

As noted previously, the URL is just a way to configure the client's
connection. The URL's path and parameters are not sent across the wire to
the broker like they would be for a HTTP URL. Typically the only thing that
the client understands about "where" to connect is host and port.

That said, you *can* configure a core client to use HTTP [1] and you can
also configure the "servletPath" URL parameter, e.g.:

    tcp://host:port?httpEnabled=true;servletPath=a

I'm not really sure if this would give you the functionality you're looking
for, but I do know that using HTTP isn't ideal from a performance
perspective.


Justin

[1]
https://activemq.apache.org/components/artemis/documentation/latest/configuring-transports.html#configuring-netty-http

On Thu, Apr 20, 2023 at 11:19 AM Bögershausen, Merlin <
merlin.boegershausen@rwth-aachen.de> wrote:

> Hi Justin,
> thanks for your reply. I know it is TCO and the answer maybe no, that
> never will work. And I am afraid your next message will be exactly this.
> But anyway.
> To clarify: I borrowed "context" from the JavaEE configuration jargon
> where context refers to the URL path under which deployment is accessible.
> Better, or more correctly, would be the term URL-Path.
>
> TL/DR: The URL Path is used to forward our connection to the correct
> server.
>
> Here is our situation, also illustrated in the picture under [1].
> Our customer has a JBoss Application Server with ActiveMQ deployed in
> default configuration as shipped with JBoss 7.4. Let's call this server
> 'as1'.
> Currently our application connects directly to the broker via
> tcp://as1:8080/ and everything works fine.
> Soon our customer implements the new policy that systems must communicate
> over a proxy, let the host be 'proxy'. This proxy will do some stuff like
> authentication and authorization. It works well for all http related stuff.
> It uses the first parts of URL-Path to identify the context and look up how
> to forward and handle the request, let our identification be 'a'.
> To connect via http to as1 via the proxy the correct URL would be
> http://proxy:8080/a which is forwarded to http://as1:8080/, additional
> Parts of the Path will be concatenated so proxy:8080/a/ui -> as1:8080/ui.
>
> Our hope, still, is that it may be possible to use the proxy also for our
> connection to the ActiveMQ. In theory tcp://proxy:8080/a but as you pointed
> out, the protocol doesn't know about paths. Our hope originally came from
> the possibility to attach something which looks like Request-parameter
> behind the '?'.
>
> To state the next question clear, do you see any way that we may use a
> http connection to as1 via proxy for the communication to the ActiveMQ?
>
>
> Best Merlin
> [1]
> https://excalidraw.com/#json=ALhV_uKADGS5mGmParJzs,oE-EEagQFkkJMWndMTFc0A
>
> Am 20.04.23, 16:02 schrieb "Justin Bertram" <jbertram@apache.org <mailto:
> jbertram@apache.org>>:
>
>
> I'm not aware of any way to specify a "context" on the client's connection
> URL. Furthermore, I don't how the broker would be configured to handle the
> context and provide different behavior between different contexts.
>
>
> Can you clarify your use-case here? Why exactly do you want/need to use a
> "context" on the client's connection URL? What difference do you want it to
> make when actually connecting to the broker?
>
>
> It's worth noting that the URL here is just a way to configure the client's
> connection. Under the covers the connection is a standard TCP connection. A
> "context" doesn't really have any protocol-level meaning here like it would
> in, for example, HTTP.
>
>
>
>
> Justin
>
>
> On Thu, Apr 20, 2023 at 5:35 AM Bögershausen, Merlin <
> merlin.boegershausen@rwth-aachen.de <mailto:
> merlin.boegershausen@rwth-aachen.de>> wrote:
>
>
> > Hi ActiveMQ Users,
> > we use an ActiveMQ deployed on JBoss 7.4 as Messaging Broker for JMS
> > Messages. We have a requirement that the ActiveMQ is reachable under a
> > Context, let’s say ‘jms’ so for example “tcp://localhost:8080/jms”.
> > We use org.apache.activemq:artemis-jms-client:2.19.1 to connect our Java
> > Application to Artemis with the configuration :
> > ```java
> > var conectionFactory = new
> > ActiveMQConnectionFactory(“tcp://localhost:8080/jms”);
> > ```
> > Within the constructor of ActiveMQConnectionFactory the methode
> > ActiveMQConnectionFactory#setBrokerURL is called which forwards
> > “tcp://localhost:8080/jms” to ServerLocatorImpl#newLocator. From here the
> > context ‘jms’ is missing, and the connections are opened against
> > “tcp://localhost:8080/”.
> >
> > Is there any Build-in way to archive a connection against a context, do
> we
> > have to implement our own ServerLocator or is it impossible to connect
> > against a context?
> >
> > Best Merlin
> >
>
>
>
>

Re: ActiveMQ deployed in server context

Posted by "Bögershausen, Merlin" <me...@rwth-aachen.de>.
Hi Justin,
thanks for your reply. I know it is TCO and the answer maybe no, that never will work. And I am afraid your next message will be exactly this. But anyway.
To clarify: I borrowed "context" from the JavaEE configuration jargon where context refers to the URL path under which deployment is accessible. Better, or more correctly, would be the term URL-Path.

TL/DR: The URL Path is used to forward our connection to the correct server.

Here is our situation, also illustrated in the picture under [1].
Our customer has a JBoss Application Server with ActiveMQ deployed in default configuration as shipped with JBoss 7.4. Let's call this server 'as1'.
Currently our application connects directly to the broker via tcp://as1:8080/ and everything works fine.
Soon our customer implements the new policy that systems must communicate over a proxy, let the host be 'proxy'. This proxy will do some stuff like authentication and authorization. It works well for all http related stuff. It uses the first parts of URL-Path to identify the context and look up how to forward and handle the request, let our identification be 'a'.
To connect via http to as1 via the proxy the correct URL would be http://proxy:8080/a which is forwarded to http://as1:8080/, additional Parts of the Path will be concatenated so proxy:8080/a/ui -> as1:8080/ui.

Our hope, still, is that it may be possible to use the proxy also for our connection to the ActiveMQ. In theory tcp://proxy:8080/a but as you pointed out, the protocol doesn't know about paths. Our hope originally came from the possibility to attach something which looks like Request-parameter behind the '?'.

To state the next question clear, do you see any way that we may use a http connection to as1 via proxy for the communication to the ActiveMQ?


Best Merlin
[1] https://excalidraw.com/#json=ALhV_uKADGS5mGmParJzs,oE-EEagQFkkJMWndMTFc0A

Am 20.04.23, 16:02 schrieb "Justin Bertram" <jbertram@apache.org <ma...@apache.org>>:


I'm not aware of any way to specify a "context" on the client's connection
URL. Furthermore, I don't how the broker would be configured to handle the
context and provide different behavior between different contexts.


Can you clarify your use-case here? Why exactly do you want/need to use a
"context" on the client's connection URL? What difference do you want it to
make when actually connecting to the broker?


It's worth noting that the URL here is just a way to configure the client's
connection. Under the covers the connection is a standard TCP connection. A
"context" doesn't really have any protocol-level meaning here like it would
in, for example, HTTP.




Justin


On Thu, Apr 20, 2023 at 5:35 AM Bögershausen, Merlin <
merlin.boegershausen@rwth-aachen.de <ma...@rwth-aachen.de>> wrote:


> Hi ActiveMQ Users,
> we use an ActiveMQ deployed on JBoss 7.4 as Messaging Broker for JMS
> Messages. We have a requirement that the ActiveMQ is reachable under a
> Context, let’s say ‘jms’ so for example “tcp://localhost:8080/jms”.
> We use org.apache.activemq:artemis-jms-client:2.19.1 to connect our Java
> Application to Artemis with the configuration :
> ```java
> var conectionFactory = new
> ActiveMQConnectionFactory(“tcp://localhost:8080/jms”);
> ```
> Within the constructor of ActiveMQConnectionFactory the methode
> ActiveMQConnectionFactory#setBrokerURL is called which forwards
> “tcp://localhost:8080/jms” to ServerLocatorImpl#newLocator. From here the
> context ‘jms’ is missing, and the connections are opened against
> “tcp://localhost:8080/”.
>
> Is there any Build-in way to archive a connection against a context, do we
> have to implement our own ServerLocator or is it impossible to connect
> against a context?
>
> Best Merlin
>




Re: ActiveMQ deployed in server context

Posted by Justin Bertram <jb...@apache.org>.
I'm not aware of any way to specify a "context" on the client's connection
URL. Furthermore, I don't how the broker would be configured to handle the
context and provide different behavior between different contexts.

Can you clarify your use-case here? Why exactly do you want/need to use a
"context" on the client's connection URL? What difference do you want it to
make when actually connecting to the broker?

It's worth noting that the URL here is just a way to configure the client's
connection. Under the covers the connection is a standard TCP connection. A
"context" doesn't really have any protocol-level meaning here like it would
in, for example, HTTP.


Justin

On Thu, Apr 20, 2023 at 5:35 AM Bögershausen, Merlin <
merlin.boegershausen@rwth-aachen.de> wrote:

> Hi ActiveMQ Users,
> we use an ActiveMQ deployed on JBoss 7.4 as Messaging Broker for JMS
> Messages. We have a requirement that the ActiveMQ is reachable under a
> Context, let’s say ‘jms’ so for example “tcp://localhost:8080/jms”.
> We use org.apache.activemq:artemis-jms-client:2.19.1 to connect our Java
> Application to Artemis with the configuration :
> ```java
> var conectionFactory = new
> ActiveMQConnectionFactory(“tcp://localhost:8080/jms”);
> ```
> Within the constructor of ActiveMQConnectionFactory the methode
> ActiveMQConnectionFactory#setBrokerURL is called which forwards
> “tcp://localhost:8080/jms” to ServerLocatorImpl#newLocator. From here the
> context ‘jms’ is missing, and the connections are opened against
> “tcp://localhost:8080/”.
>
> Is there any Build-in way to archive a connection against a context, do we
> have to implement our own ServerLocator or is it impossible to connect
> against a context?
>
> Best Merlin
>