Commit Graph

123 Commits

Author SHA1 Message Date
Rossen Stoyanchev
e637418010 Update stomp/websocket documentation 2013-12-11 23:36:55 -05:00
Rossen Stoyanchev
92dad1849f Rename @[Path/Destination]Variable in spring-messaging
Issue: SPR-11208
2013-12-11 14:44:57 -05:00
Phillip Webb
a1529d498e Fix possible GenericMsgTemplate race condition
Fix a potential race condition with GenericMessagingTemplate's inner
TemporaryReplyChannel class.

Prior to this commit the `hasReceived` member variable was read after
calling `replyLatch.countDown()`.

Issue: SPR-11206
2013-12-11 00:08:34 -08:00
Rossen Stoyanchev
fcecd0328a Collapse messaging.simp.handler into messaging.simp 2013-12-06 17:23:31 -05:00
Rossen Stoyanchev
307bf4bede Add messaging.simp.user package 2013-12-06 17:05:29 -05:00
Rossen Stoyanchev
89455c00f6 Create messaging.simp.broker package 2013-12-06 16:24:04 -05:00
Juergen Hoeller
7a154e8e98 Renamed handler.support to handler.invocation 2013-12-06 21:50:47 +01:00
Juergen Hoeller
c4163c7475 Moved messaging.support.converter to messaging.converter; moved messaging.support.tcp to messaging.tcp; moved messaging.support.channel to messaging.support itself; moved handler.condition to handler itself; reworked handler.method into handler.support 2013-12-06 18:24:38 +01:00
Rossen Stoyanchev
947f3d4b2b Update Javadoc, add tests and polish spring-messaging 2013-12-05 21:30:52 -05:00
Rossen Stoyanchev
47ef45d152 Polish websocket xml namespace
Issue: SPR-11063
2013-12-02 15:25:49 -05:00
Brian Clozel
10f5d96a78 Add XML namespace for WebSocket config
This commit adds an XML namespace equivalent of @EnableWebSocket and
@EnableWebSocketMessageBroker. Those are <websocket:handlers> and
<websocket:message-broker> respectively.

Examples can be found in the test suite.

This commit also alters the way MessageHandler's subscribe to their
respective MessageChannel's of interest. Rather than performing the
subscriptions in configuration code, the message channels are now
passed into MessageHandler's so they can subscribe themselves on
startup.

Issue: SPR-11063
2013-12-02 12:18:33 -05:00
Phillip Webb
043a41e382 Consistent whitespace after imports
Update code to have a consistent number of new-line characters after
import statements.
2013-11-26 15:14:43 -08:00
Phillip Webb
15698860e1 General polish of new 4.0 classes
Apply consistent styling to new classes introduced in Spring 4.0.

- Javadoc line wrapping, whitespace and formatting
- General code whitespace
- Consistent Assert.notNull messages
2013-11-26 15:11:18 -08:00
Rossen Stoyanchev
690051f46c Add ability to customize message channels
@EnableWebSocketMessageBroker message channel configuration can now be
customized via WebSocketMessageBrokerConfigurer. It is necessary to
make this easy and even required as part of the basic configuration
since by default the message channels are backed by a thread pool of
size 1, not suitable for production use.

Issue: SPR-11023
2013-11-26 16:51:14 -05:00
Phillip Webb
a31ac882c5 Fix various javadoc warnings 2013-11-26 13:25:37 -08:00
Rossen Stoyanchev
ce3e55743f Extract IdGenerator into a top-level class 2013-11-25 21:50:47 -05:00
Eric Dahl
e9f78f6043 Fix various typos
Fix a variety of typos throughout the project, primarily in
comments (javadoc or otherwise) but also in a handful of log messages
and a couple exception messages.

ISSUE: SPR-11123
2013-11-25 15:58:27 -08:00
Phillip Webb
59002f2456 Fix remaining compiler warnings
Fix remaining Java compiler warnings, mainly around missing
generics or deprecated code.

Also add the `-Werror` compiler option to ensure that any future
warnings will fail the build.

Issue: SPR-11064
2013-11-25 12:52:42 -08:00
Rossen Stoyanchev
4de3291dc7 Consolidate websocket/messaging code
Before this change spring-messaging contained a few WebSocket-related
classes including WebSocket sub-protocol support for STOMP as well
as @EnableWebSocketMessageBroker and related configuration classes.

After this change those classes are located in the spring-websocket
module under org.springframework.web.socket.messaging.

This means the following classes in application configuration must
have their packages updated:

org.springframework.web.socket.messaging.config.EnableWebSocketMessageBroker
org.springframework.web.socket.messaging.config.StompEndpointRegistry
org.springframework.web.socket.messaging.config.WebSocketMessageBrokerConfigurer

MessageBrokerConfigurer has been renamed to MessageBrokerRegistry and
is also located in the above package.
2013-11-23 21:09:17 -05:00
Rossen Stoyanchev
35b9b8400b Rename @SubscribeEvent to @SubscribeMapping
Also @SubscribeMapping is now a method-level annotation only that can
be used in combination with a type-level @MessageMapping.

This method also documents supported method arguments and return value
types on @Subscribe- and @MessageMapping methods.
2013-11-15 16:34:27 +00:00
Rossen Stoyanchev
6802f813de Polish STOMP codec
Issue: SPR-11088
2013-11-13 13:45:56 -05:00
Andy Wilkinson
e84885c655 Update STOMP decoder to handle incomplete frames
Previously, StompDecoder would throw a StompConversionException when
it attempted to decode a Buffer that contained an incomplete frame.

This commit updates StompDecoder to return null when it encounters an
incomplete frame. It also resets the buffer, thereby allowing the
decode to be reattempted once more data has been received.
StompCodec's decoder function has been updated to stop attempting to
decode a Buffer when StompDecoder returns null.

Issue: SPR-11088
2013-11-13 13:45:12 -05:00
Rossen Stoyanchev
df5d22e120 Improve logging in spring-messaging
Before this change the amount of logging was too little or too much
with TRACE turned on. This change separates useful debugging
information and logs it under DEBUG and leaves more detailed
information to be logged under TRACE.
2013-11-12 16:34:25 -05:00
Rossen Stoyanchev
72dec7d0fe Add default destination for @SendTo methods
Issue: SPR-11085
2013-11-11 16:59:36 -05:00
Rossen Stoyanchev
5915b23e8a Rename method in MessageBrokerConfigurer 2013-11-10 10:47:35 -05:00
Rossen Stoyanchev
2a6c1f75e7 Simplify determination of SockJS path
The SockJS path is now passed to the SockJsService handleRequest method
thus removing the need to guess it.

Issue: SPR-11058
2013-11-07 22:28:15 -05:00
Rossen Stoyanchev
6a18daea33 Return AbstractSubscribableChannel from @Bean methods
Declare SubscribableChannel @Beans in
WebSocketMessageBrokerConfigurationSupport as
AbstractSubscribableChannel to avoid the need for casting when
registering interceptors.

Issue: SPR-11065
2013-11-07 22:28:00 -05:00
Rossen Stoyanchev
0340cc5f03 Update user destinations handling
Before this change subscribing to a user-specific destination in STOMP
required manually appending a unique queue suffix provided in a header
with the CONNECTED frame.

This change removes the need to do that. Instead STOMP clients can
subscribe to "/user/queue/error" and can then begin to receive messages
sent to "/user/{username}/queue/error" without colliding with any other
user doing the same.

Issue: SPR-11077
2013-11-07 17:37:41 -05:00
Rossen Stoyanchev
c6c5555034 Use final keyword in MessageHeaders 2013-11-05 10:06:35 -05:00
Rossen Stoyanchev
a640d84961 Fix issue in AbstractMethodMessageHandler 2013-10-29 21:57:27 -04:00
Rossen Stoyanchev
164a9f938c Update the Jetty WebSocket adapter
This changes switches from using Jetty's WebSocketListener interface
to use Jetty's @WebSocket annotations instead. The change should be
transparent but the annnotations provide a little more controler
including handling pong frames.

This change also introduces a WebSocketMessage interface.

Issue: SPR-10877
2013-10-29 21:37:49 -04:00
Sam Brannen
bf9ec78c5d Polish spring-messsaging
- Removed unused imports
- Organized imports
- Discontinued use of deprecated junit.framework.Assert class
- Suppressed warnings where appropriate
- Added missing generics to return type for getMappingComparator() in
  SimpAnnotationMethodMessageHandler
2013-10-29 19:29:23 +01:00
Brian Clozel
6d00a3f0ee Add support for WebSocket Protocol Extensions
This commits adds simple, overridable WebSocket Extension
filtering during the handshake phase and adds that
information in the WebSocket session.

The actual WebSocket Extension negotiation happens
within the server implementation (Glassfish, Jetty, Tomcat...),
so one can only remove requested extensions from
the list provided by the WebSocket client.

See RFC6455 Section 9.

Issue: SPR-10843
2013-10-28 22:40:22 -04:00
Phillip Webb
12e896ed8b Polish 2013-10-25 16:42:47 -07:00
Rossen Stoyanchev
b8809daf5f Refactor HandlerMethod support in spring-messaging
Introduce base class AbstractMethodMessageHandler for
HandlerMethod-based message handling.

Add MessageCondition interface for mapping conditions to messages
with support for combining type- and method-level annotation
conditions, the ability to match conditions to messages, and also
comparing matches to select the best match.

Issue: SPR-11024
2013-10-24 21:50:49 -04:00
Rossen Stoyanchev
4892a27016 Add STOMP broker relay unit tests 2013-10-23 16:26:28 -04:00
Rossen Stoyanchev
bfa6645c7d Make changes for timing related test failures 2013-10-23 13:24:25 -04:00
Rossen Stoyanchev
2d78a066fb Add ListenableFuture to TcpOperations connect methods 2013-10-23 11:55:43 -04:00
Rossen Stoyanchev
f3ca3c108c Switch to reactor snapshots and make use of API change 2013-10-22 22:34:41 -04:00
Rossen Stoyanchev
8917821e95 Polish GenericMessage 2013-10-21 16:29:01 -04:00
Rossen Stoyanchev
92a48b72d7 Polish (minor) 2013-10-21 16:26:07 -04:00
Rossen Stoyanchev
d2eff4ead6 Improve GenericMessage.toString()
Restore pringing the payload first and headers second as it has been in
SI but also handle specifically the case where the body is a byte array
to minimize unnecessary "noise" that causes otherwise for STOMP msgs.
2013-10-18 15:28:59 -04:00
Rossen Stoyanchev
61d13547e1 Remove @UnsubscribeEvent
The STOMP UNSUBSCRIBE message does not have a destination header so
there is no obvious simple way to do a mapping and the need for it
is not clear yet.
2013-10-18 15:15:24 -04:00
Rossen Stoyanchev
715a11ce8c Polish AnnotationMethodMessageHandler and annotations 2013-10-18 15:10:34 -04:00
Brian Clozel
fb586da673 Support @PathVariable in annotated message handling methods
Prior to this commit, @SubscribeEvent @UnsubscribeEvent and
@MessageMapping annotated message handling methods
could only match a strict message destination.

This commit adds a @PathVariable annotation and
updates the message matching/handling process, since
message handling methods can now match PathMatcher-like
destinations and get path variables injected in parameters.

Issue: SPR-10949
2013-10-18 15:10:34 -04:00
Rossen Stoyanchev
be4e5d2841 Add SimpleMessageConverter 2013-10-18 11:33:59 -04:00
Rossen Stoyanchev
a53233b351 Fix issue in AbstractMessagingTemplate 2013-10-17 22:23:03 -04:00
Rossen Stoyanchev
29934d7c02 Add TCP abstractions to spring-messaging
This change adds abstractions for opening and managing TCP connections
primarily for use with the STOMP broker support. As one immediate
benefit the change makes the  StompBrokerRelayMessageHandler more
easy to test.
2013-10-17 22:16:15 -04:00
Rossen Stoyanchev
a172b32d4c Refactor STOMP relay session
This change consolidates TCP-related logic in the StompRelaySession. As
a result the sub-class SystemStompRelaySession now contains only logic
intrinsic to the shared system session.
2013-10-17 22:16:14 -04:00
Rossen Stoyanchev
17aea892f0 Fix issue with forwarding messaging to STOMP broker 2013-10-17 22:16:14 -04:00