Commit Graph

6805 Commits

Author SHA1 Message Date
Rossen Stoyanchev
01c4e458c7 Add support for "system" STOMP session
The "system" STOMP session is established at startup and can be used
to send messages without a client session, e.g. to support broadcasting
from a REST/HTTP handler method.
2013-06-19 18:54:51 -04:00
Rossen Stoyanchev
44db0f815a Add MessageHolder
MessageHolder holds the currently processed message in a ThreadLocal,
which allows PubSubMessageBuilder to automatically add a session id
to messages to be sent.
2013-06-19 15:30:23 -04:00
Rossen Stoyanchev
5cfc59d76d Refactor PubSubHeaders, StompHeaders, MessageBuilder
Rename to PubSubHeaderAccessor and StompHeaderAccessor
Move the renamed classes to support packages

Remove fromPayloadAndHeaders from MessageBuilder, just use
withPayload(..).copyHeaders(..) instead.
2013-06-19 11:41:43 -04:00
Rossen Stoyanchev
811bb1b0c9 Improve synchronization checks in STOMP relay session 2013-06-19 08:28:58 -04:00
Andy Wilkinson
28174744a7 Fix race when flushing messages
The use of an AtomicBoolean and no lock meant that it was possible
for a message to be queued and then never be flushed and sent to the
broker:

1. On t1, a message is received and isConnected is false. The message
   will be queued.
2. On t2, CONNECTED is received from the broker. isConnected is set
   to true, the queue is drained and the queued messages are forwarded
3. On t1, the message is added to the queue

To fix this, checking that isConnected is false (step 1 above) and the
queueing of a message (step 3 above) need to be performed as a unit
so that the flushing of the queued messages can't be interleaved. This
is achieved by synchronizing on a monitor and performing steps 1
and 3 and synchronizing on the same monitor while performing step 2.

The monitor is held while the messages are actually being forwarded
to the broker. An alternative would be to drain the queue into
a local variable, release the monitor, and then forward the messages.
The main advantage of this alternative is that the monitor is held for
less time. It also reduces the theoretical risk of deadlock by not
holding the monitor while making an alien call. The downside of the
alternative is that it may lead to messages being forwarded out of
order. For this reason the alternative approach was rejected.
2013-06-19 11:02:10 +01:00
Rossen Stoyanchev
3c6c56fe0d Fix issue with obtaining WebSocketContainer 2013-06-18 20:55:22 -04:00
Rossen Stoyanchev
3f9da6f480 Add generic parameters to MessageHandler impls 2013-06-18 20:35:15 -04:00
Andy Wilkinson
f6398e14d0 Received message's destination is default for resp
When an annotated handler returns a Message from a @SubscribeEvent
or @MessageMapping method and it contains no destination in its
headers, use the received message's destination as the response
message's destination.
2013-06-17 21:04:23 -04:00
Andy Wilkinson
7bb3b824c3 Genericize PubSubChannelRegistry
Without generics, extending AbstractPubSubChannelRegistry and using
a custom Message type requires some unpleasant casting and suppression
of warnings. By genericizing PubSubChannelRegistry and
AbstractPubSubChannelRegistry these problems can be avoided.
2013-06-17 21:03:24 -04:00
Rossen Stoyanchev
426875b4f6 Refactor StompRelayPubSubMessageHandler 2013-06-17 16:29:31 -04:00
Rossen Stoyanchev
3dabe21563 Remove PubSubChannelRegistryBuilder 2013-06-17 10:22:58 -04:00
Rossen Stoyanchev
6f4cc4f170 Polish PubSubChannelRegistryBuilder 2013-06-14 22:24:03 -04:00
Rossen Stoyanchev
4f7d77f631 Add PubSubChannelRegistry and associated builder 2013-06-14 22:07:47 -04:00
Rossen Stoyanchev
c5b1f02c3a Add MessageBuilder 2013-06-14 16:30:02 -04:00
Andy Wilkinson
3022f5e34f Make Message type pluggable
To improve compatibility between Spring's messaging classes and
Spring Integration, the type of Message that is created has been made
pluggable through the introduction of a factory abstraction;
MessageFactory.

By default a MessageFactory is provided that will create
org.springframework.messaging.GenericMessage instances, however this
can be replaced with an alternative implementation. For example,
Spring Integration can provide an implementation that creates
org.springframework.integration.message.GenericMessage instances.

This control over the type of Message that's created allows messages
to flow from Spring messaging code into Spring Integration code without
any need for conversion. In further support of this goal,
MessageChannel, MessageHandler, and SubscribableChannel have been
genericized to make the Message type that they deal with more
flexible.
2013-06-14 12:34:12 +01:00
Rossen Stoyanchev
641aaf4b6a Use tcp-reactor in StompRelayMessageHandler 2013-06-13 21:48:51 -04:00
Rossen Stoyanchev
78d1063e37 Replace use of PubSub header name literals 2013-06-13 15:24:49 -04:00
Rossen Stoyanchev
d136d06eda Add method to create MessageHeaders in Message 2013-06-13 13:51:21 -04:00
Rossen Stoyanchev
bfba9115a6 Merge pull request #1 from wilkinsona/assert-import
Correct the Assert imports
2013-06-13 09:15:29 -07:00
Andy Wilkinson
8cea9ca962 Correct the Assert imports
Import org.springframework.util.Assert rather than reactor.util.Assert
2013-06-13 15:44:01 +01:00
Rossen Stoyanchev
3712f73f38 Remove EventBus 2013-06-13 01:36:55 -04:00
Rossen Stoyanchev
3e0aac08dc Add SubscribableChannel and ReactorMessageChannel 2013-06-13 01:13:37 -04:00
Rossen Stoyanchev
a1cfa3832e Polish 2013-06-13 01:13:04 -04:00
Rossen Stoyanchev
c420f37137 Fix setting of message-id STOMP header 2013-06-12 13:39:35 -04:00
Rossen Stoyanchev
82dfd781d0 Consolidate STOMP WebSocketHandler class hierarchy 2013-06-12 09:43:40 -04:00
Rossen Stoyanchev
ad41f095a1 Refactor STOMP and PubSub header message support 2013-06-11 17:07:48 -04:00
Rossen Stoyanchev
e7dde941b7 Update STOMP MESSAGE frames with messageId 2013-06-11 10:49:31 -04:00
Rossen Stoyanchev
d26b9d60e5 Refactor approach to working with STOMP headers 2013-06-11 01:52:32 -04:00
Rossen Stoyanchev
547167e8b4 Remove remaining Reactor event wrapping 2013-06-10 13:59:19 -04:00
Rossen Stoyanchev
84c55f90db Make MessageHeaders non-final 2013-06-10 10:09:24 -04:00
Rossen Stoyanchev
de899820c9 Add Message, MessageChannel and refactor stomp support 2013-06-09 19:36:46 -04:00
Rossen Stoyanchev
8913283ce0 Add AnnotationStompService 2013-06-03 19:35:40 -04:00
Rossen Stoyanchev
b194d4d6a0 Add AbstractStompService 2013-05-30 15:29:46 -04:00
Rossen Stoyanchev
4de40fad8e Refactor STOMP package and class names 2013-05-30 15:29:20 -04:00
Rossen Stoyanchev
2b5acbda99 Add handling for remaining STOMP server commands 2013-05-30 15:28:42 -04:00
Rossen Stoyanchev
69ef364ef9 Introduce messaging package
org.springframework.web.stomp is now
org.springframework.web.messaging.stomp

Also classes in the ~.stomp.server and ~.stomp.adapter packages have
been renamed.
2013-05-30 15:28:42 -04:00
Rossen Stoyanchev
c67b694339 Add STOMP service that relays messages to STOMP broker 2013-05-30 15:28:42 -04:00
Rossen Stoyanchev
3eac62925b Add basic stomp error handling 2013-05-30 15:28:42 -04:00
Rossen Stoyanchev
730d456e84 Add early STOMP/reactor support 2013-05-30 15:28:42 -04:00
Rossen Stoyanchev
827e20e37f Upgrade javax.websocket and tyrus dependencies to 1.0 2013-05-30 15:25:01 -04:00
Phillip Webb
e63ee1ee5a Fixed typo in docbook id
Issue: SPR-10394
2013-05-28 14:25:57 -07:00
Chris Beams
ba45f70342 Merge pull request #291 from dsyer/10579
# By Chris Beams (1) and Dave Syer (1)
* SPR-10579:
  Polish pull request #291 per committer guidelines
  Make CommandLinePropertySource enumerable
2013-05-28 13:52:01 +02:00
Chris Beams
46d47fef9a Polish pull request #291 per committer guidelines
- Update Apache license headers
 - Remove trailing whitespace
 - Edit original commit comment to use 'Issue:' syntax
 - Revert use of diamond operator (<>) in main sources

See committer guidelines at
https://github.com/SpringSource/spring-framework/blob/master/CONTRIBUTING.md

Issue: SPR-10579
2013-05-28 13:51:35 +02:00
Dave Syer
7860af8624 Make CommandLinePropertySource enumerable
JOpt 4.4 has enumerable options, so this change can be made
if we upgrade. The only awkward thing is that JOpt allows
aliases for options, so we have to pick one to avoid double
counting. This implementation picks the last one in the list
which is the alphebtically last of the long options, if there
are any (e.g. "o1", "option1" returns "option1"). Most of the
time there will only be one or two aliases for each option so
it won't matter.

Issue: SPR-10579
2013-05-28 12:57:01 +02:00
Chris Beams
3c73a8fc4f Instruct contributors to branch from master 2013-05-28 13:54:14 +03:00
Sam Brannen
00fea1f715 Fix minor typo in README.md 2013-05-26 14:28:37 +02:00
Rob Winch
07b7553355 Fix MergePlugin
The submitted pull requests for SPR-10572 did not build.

This commit fixes the MergePlugin to create from configurations rather
than the project. It also removes unnecessarily added code that was
commented out.

Issue: SPR-10572
2013-05-22 14:57:22 -05:00
Stevo Slavic
bf205bfe79 Eliminate Gradle 1.6 deprecation warnings
Recently Spring framework build has been updated to use Gradle 1.6.
With the new version some of the Gradle APIs have been deprecated.
These deprecated APIs have been used by Spring build specific Gradle
plugins, which resulted in deprecation warnings in build output.

This patch changes Spring build specific Gradle plugins to use new
Gradle APIs instead of deprecated ones.

Even after this change build still produces warnings about Gradle
deprecated APIs being used. These come from Spring shared Gradle
plugins and other 3rd party Gradle plugins in use, like Gradle
Artifactory Plugin (GAP), which are still not updated to Gradle 1.6.
Related tickets for updating of these plugins to Gradle 1.6 are
GRADLE-53 and GAP-144, and once they get resolved Spring framework
build should further be updated.

Issue: SPR-10572
2013-05-22 14:57:21 -05:00
Chris Beams
3865a8706c Revise note on avoiding "lambda" JDK 2013-05-22 10:06:13 +02:00
Chris Beams
eae0f8b53a Merge pull request #288 from dsyer/patch-1
Update README adding explicit JDK instructions
2013-05-22 00:58:23 -07:00