activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neb Bozovic (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (AMQ-5272) Implement JSR 356 based WebSocket transport
Date Thu, 17 Jul 2014 20:47:04 GMT

    [ https://issues.apache.org/jira/browse/AMQ-5272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14065516#comment-14065516
] 

Neb Bozovic edited comment on AMQ-5272 at 7/17/14 8:45 PM:
-----------------------------------------------------------

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:
{code}
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);
  ...
}
{code}
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.


was (Author: nbozovic):
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)

Mime
View raw message