[ 
https://issues.apache.org/jira/browse/AMQ-5272?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Neb Bozovic updated AMQ-5272:
-----------------------------

    Attachment: StompTransportServer.java
                StompEndpoint.java

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
  broker.addConnector(stompConnector);
  ...
  ServerContainer serverContainer = (ServerContainer) 
sce.getServletContext().getAttribute(ServerContainer.class.getName());
  serverContainer.addEndpoint(stompServer);
  ...
}

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: https://issues.apache.org/jira/browse/AMQ-5272
>             Project: ActiveMQ
>          Issue Type: New Feature
>            Reporter: Neb Bozovic
>            Priority: Minor
>         Attachments: StompEndpoint.java, StompTransportServer.java
>
>
> 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
(v6.2#6252)

Reply via email to