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.boegershau...@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" <jbert...@apache.org <mailto: > jbert...@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.boegershau...@rwth-aachen.de <mailto: > merlin.boegershau...@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 > > > > > >