activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neb Bozovic (JIRA)" <>
Subject [jira] [Updated] (AMQ-5272) Implement JSR 356 based WebSocket transport
Date Thu, 17 Jul 2014 20:45:06 GMT


Neb Bozovic updated AMQ-5272:


Well, that was a bit harder than I thought, but a functional example (in my limited testing,
Tomcat 7.0.54) is attached. You probably wouldn't use it as-is, but it demonstrates the concept.

It is initialized thusly:

public void contextInitialized(ServletContextEvent sce) {
  BrokerService broker = ...
  TransportServer stompServer = new StompTransportServer();
  TransportConnector stompConnector = new TransportConnector(stompServer);
  stompConnector.setUri(URI.create("ws://container")); //if not, NPE in TransportConnection
  ServerContainer serverContainer = (ServerContainer) sce.getServletContext().getAttribute(ServerContainer.class.getName());

It probably makes sense to refactor the existing WS support to go through JSR-356, since recent
versions of embedded Tomcat and Jetty both support it. Thus, both the embedded and standalone
scenarios can be supported through one standard API.

> Implement JSR 356 based WebSocket transport
> -------------------------------------------
>                 Key: AMQ-5272
>                 URL:
>             Project: ActiveMQ
>          Issue Type: New Feature
>            Reporter: Neb Bozovic
>            Priority: Minor
>         Attachments:,
> The present WS transport boots up an embedded Jetty instance on its own port, which does
not make sense when embedding ActiveMQ in a container-hosted application.
> Although not that difficult to hack together manually, there should be a supported first-party
mechanism to configure a WS Stomp/MQTT endpoint when embedded in a JSR 356 compatible container.

This message was sent by Atlassian JIRA

View raw message