Commit Graph

506 Commits

Author SHA1 Message Date
Gary Russell
c309741003 AMQP-268 Fix Appender MDC Properties
MDC Properties were being stored under key
Entry.toString() instead of Entry.getKey().toString().
2013-02-27 12:38:25 -05:00
Spring Buildmaster
98bc284432 [artifactory-release] Next development version 2012-11-06 13:15:21 -08:00
Spring Buildmaster
48695087d6 [artifactory-release] Release version 1.1.3.RELEASE 2012-11-06 13:15:16 -08:00
Gary Russell
66d4981314 INT-280 Fix Test Case Race Condition
stop() container AFTER testing that mock.close() was never called.
2012-11-06 15:57:11 -05:00
Gary Russell
2909b36e8d Fix Bundlor Versions for 1.1.3 Release 2012-11-06 15:25:27 -05:00
Gary Russell
8f533c86f5 AMQP-277 Add DefaultType to DefaultClassMapper
Permit the use of a JsonMessageConverter when no type information
is provided in the MessageProperties and the type is known.
2012-11-06 14:04:49 -05:00
Gary Russell
9c29a74add AMQP-274 Local Transaction Issues
When running a listener container with local transactions
(channelTransacted, and no external transaction manager), the
consumer's channel is bound to the thread for use by downstream
RabbitTemplates.

However, the syncronizedWithTransaction boolean was not set so
the RabbitTemplate closed the channel after its operation.

We should never close the consumer's channel.

The solution is to set the boolean when binding the resource.

In addition, when using a RabbitTransactionManager, the
RabbitResourceHolder.closeAll() method would close the consumer's
channel.

Previously, the consumer's channel was registered with a
ThreadLocal in the ConnectionFactoryUtils. This enabled
the doGetTransactionalResourceHolder method to bind the
consumer's channel.

The RabbitResourceHolder.closeAll() now examines the channels
is it closing and skips the close for the consumer's channel.

Added tests to the Local and External transaction test cases
to ensure the appropriate channel.close() calls are executed,
depending on the scenario. e.g. a local transaction with
exposeListenerChannel=false should close() the exposed channel
but not the consumer's channel.
2012-11-05 17:33:39 -05:00
Gary Russell
dd54e66fab AMQP-275 Reduce StopStart Test Size
Reduce number of messages
Reduce concurrency and prefetch
Increase stop/start frequency
2012-11-05 16:18:08 -05:00
Gary Russell
c675a7ff32 AMQP-275 Physically Close Channel on Listener Stop
When stopping a listener container, physically close the channel
so any queued, but not yet processed messages go back to Ready
instead of remaining un-ack'd.

Rename methods to is/setPhysicalCloseRequired()
2012-11-05 15:02:34 -05:00
Gary Russell
e948b32545 AMQP-240 Reference Docs for Confirms and Returns
Add reference documentation.
2012-10-31 17:37:12 -04:00
Spring Buildmaster
20c410b40a [artifactory-release] Next development version 2012-08-23 12:32:50 -07:00
Spring Buildmaster
a586ab9502 [artifactory-release] Release version 1.1.2.RELEASE 2012-08-23 12:32:45 -07:00
Gary Russell
9a0596cf83 Rename spring-amqp-core to spring-amqp
Rename spring-amqp-core artifact back to spring-amqp
2012-08-23 15:12:53 -04:00
Gary Russell
ea4217a093 AMQP-267 Add bundlor to Gradle Build for 1.1.x 2012-08-22 14:30:06 -04:00
Gary Russell
0a6ba19b75 AMQP-256 Add channel-transacted to SLC Namespace
Namespace support for SimpleListenerContainer was missing
channel-transacted attribute.

AMQP-256 Polishing

Add cross check - disallow a transacted channel when
acknowlege='NONE' (autoack in Rabbit-speak).
2012-08-22 13:45:33 -04:00
Gary Russell
cc0f692d22 AMQP-262 ConcurrentExecutionException
When a 'multiple' ack is received, we iterate over pending acks for
each listener in order to generate a discrete ack for each.

While this is synchronized on the entire pending acks map, addition
of a new pending ack can cause a ConcurrentModificationException.

sychnronize the put(); add a test to reproduce the issue and to
show the correction fixes the problem.
2012-08-22 13:34:16 -04:00
Gary Russell
90c526eec6 AMQP-260 Bind Channel With Local Transaction
When using local transactions (no tx manager), the channel
should be bound to the thread to enable any upstream
RabbitTemplate operations to use the same channel.

When an external tx manager is a RabbitTransactionManager,
a different channel was bound, and the consumer channel
was not committed.

1. When invoking a MessageListener (not ChannelAware),
and exposeListenerChannel is true (default),
bind the consumer's channel to the thread to make
it available for up-stack RabbitTemplate operations.

2. When invoking a ChannelAwareMessageListener, and there
is no external tx manager, and exposeListenerChannel is
true (default), bind the channel to the thread to make
it available for up-stack RabbitTemplate operations.

3. When invoking a ChannelAwareMessageListener, and there
is no external tx manager, and exposeListenerChannel is
false, bind the new (temporary) channel to the thread to
make it available for up-stack RabbitTemplate operations.
Note that work on this temporary channel is committed on
the return and txSize has no bearing.

4. Whenever there is an external transaction manager, the
exposeListenerChannel is ignored - it is always exposed in
that case this is already documented in javadoc - add a
WARN log to the initialization code.

5. When there is an external transaction manager, (but not
a RabbitTransactionManager) the
listener's channel is always bound to the thread. This was
always the case and is mentioned here for completeness.

6. Previously, when an external transaction manager was
a RabbitTransactionManager, the wrong channel was bound
to the thread, and it was that channel that was committed,
instead of the listener channel. This was the originally
reported issue, with the workaround being to remove
the transaction manager; but that caused no channel to
be bound.

This last problem was due to the fact that the transaction
template obtained a new connection and bound it. It was
that connection that the TxManager committed.

Solution was to add a ThreadLocal to ConnectionFactoryUtils
to hold consumer channels. When the transaction starts,
the utils now look at this ThreadLocal before creating
a new connection.

The connection is unregistered when the consumer exits.

Add tests for transacted (with/without txMgr) for MessageListener
and ChannelAwareMessageListener to ensure the channel
is bound for use by up-stack templates.

Add test with Rabbit TxMgr showing correct channel
is bound and committed.

AMQP-260 Polishing
2012-08-22 12:04:57 -04:00
Dave Syer
6667565f54 AMQP-261: add brokerRunning @Rule to integration test 2012-07-26 09:22:11 -04:00
Gary Russell
8096d14847 AMQP-252 Remove System.out Call in Json Converter 2012-07-19 18:24:39 -04:00
Gary Russell
247bf0eb53 AMQP-255 Fix Multi Confirm with > 1 Listener
Rabbit can piggy-back confirms - for example, if seq 1, 2, 3 are
sent, it is possible to receive ack #3 with 'multiple' set. These
means 1, 2, and 3 are acked.

This worked fine with just one listener. However, if two or
more listeners (e.g. rabbit templates) are attached, only the
listener for ack #3 is notified (regardless of whether all
the acks belong to it).

The PublisherCallbackChannel maintains two maps: seq-to-listener
and listener-to-map(seq-to-correlation).

This fixes the problem by first finding all the listeners that
have pending confirms at or below the sequence number; and then
uses the second map to send the confirms to the appropriate
listener.

AMQP-255 Polishing

PR Comments
2012-07-19 17:59:42 -04:00
Gary Russell
902b2abdde AMQP-254 Add MessageId Advice
The RetryInterceptor requires messages to have an Id. It does not
work in an environent where some messages have an Id and some don't.

This adds an advice to enhance incoming messages with an id if it is
missing. Such messages cannot participate in the normal retry logic
(backoff policy etc), but allows 1 retry (until the redelivered
header is set). For a redelivered message without an Id, that fails,
the advice throws an AmqpRejectAndDontRequeueException, signaling the
container to tell the broker to stop delivering the message.

The broker can be configured to forward such messages to the Dead
Letter Exchange.

Add tests to verify messages with and without Ids use the
appropriated retry mechanism.

Also adds a RejectAndDontRequeueRecoverer. The default
MessageRecoverer simply eats the failed message; this recoverer
throws the message back to the broker enabling DLE/DLQ processing.
2012-07-19 16:34:12 -04:00
Oleg Zhurakousky
f7bf7c6d60 Merge branch 'AMQP-249-backport' into 1.1.x 2012-07-19 14:03:38 -04:00
Jon Brisbin
8b285910e1 AMQP-242, AMQP-243: Appender Fixes
Wrap routing key layout formatting call with a synchronized block because Log4J's PatternLayout is not thread-safe. Also added a simple fix to actually use the configured Layout, which it was previously ignoring.

Polishing @garyrussell
2012-07-18 15:42:02 -04:00
Gary Russell
a5d84a820f AMQP-249 Fix Hanging Thread/Unacked Messages
Previously, the temporary reply channel used for send and
receive operations (when not using a reply-queue) were configured
for acks, but no ack was sent. The queue is temporary so was
removed when the consumer was cancelled but, with cached channels,
the admin UI showed an unacked count for the channel.

In addition, there was a race condition that could cause a hung
thread. The handover to the calling thread was done using a
SynchronousQueue; if the caller timed out just as the reply
arrived, the consumer thread could hang on the put.

Changed the temporary reply queue declaration to use auto-ack
and changed the SynchronousQueue to an ArrayBlockingQueue.
2012-07-18 13:20:15 -04:00
Gary Russell
0261937f08 AMQP-250 Template reply-queue Could Not be Anon.
If the reply queue was defined with an id (rather than name)
attribute, the template's reply container listened on
the wrong queue name.

The template parser set the container's queues attribute
to the reply-queue attribute value, instead of a
RuntimeBeanReference to a bean of that name.

When a <queue name="foo"/> was used, it worked because
the Queue that Spring created during property assignment
had the same name and all was fine (the container uses
the queue name).

Changed the parser to correctly use a bean reference instead.
2012-07-18 12:08:39 -04:00
Gary Russell
49f8457dbd AMQP-251 Update RabbitMQ Client to 2.8.4 2012-07-18 11:53:38 -04:00
Gary Russell
3573f9a598 AMQP-190 Memory Leak With Tx and RabbitTemplate
When the RabbitTemplate is invoked with an existing transaction,
the channel is bound to the thread, and

  ConnectionFactoryUtils.releaseResources(resourceHolder);

is called after processing. There was a commented-out line
in ConnectionFactoryUtils.RabbitResourceSynchronization.afterCompletion()
that would have reset the synchronized state so that
releaseResouces() would "close" the chanel/connection (return
them to the caching factory).

Being commented out, the channel was never removed, and each
transactional template call grabbed a new channel.

However, uncommenting causes issues with the listener container
because it continues to use the channel, so it must not
be closed (made available for reuse).

Added code to reset synch, by default, but not for the listener.

The listener sets a boolean releaseAfterCompletion in the
ResourceHolder to false so that the channel remains and
is not closed (logically or otherwise).
2012-07-18 11:50:16 -04:00
Gary Russell
22c0a59c7f AMQP-253 Add Id Generation Option to AMQP Appender
log4j.appender.amqp.generateId=true

Turns on id generation - useful when configuring a
retry interceptor on the consuming side.

AMQP-253 Polishing

Fix default value; move to Message Properties.
2012-07-17 20:33:30 -04:00
Gunnar Hillert
d11991838d Merge pull request #48 from garyrussell/AMQP-247
* garyrussell-AMQP-247:
  AMQP-247 Queue ID/Name Documentation
2012-07-03 11:40:58 -04:00
Gary Russell
89f0b9c702 AMQP-247 Queue ID/Name Documentation
Add a tip explaining when to use ID Vs. name when
defining a <queue/>.
2012-07-03 11:13:12 -04:00
Gary Russell
d99640a6f2 Merge pull request #47 from ghillert/AMQP-246 2012-06-27 15:35:14 -04:00
Gunnar Hillert
013cf42a64 AMQP-246 - Remove old POMs
* Remove POMs from Project Trees After Gradle Migration
* Remove .springBeans files

For reference: https://jira.springsource.org/browse/AMQP-246

AMQP-246 - Adding .springBeans back to .gitignore
2012-06-27 15:33:10 -04:00
Gary Russell
745894580a Merge pull request #42 from ghillert/AMQP-83 2012-06-19 11:11:20 -04:00
Gunnar Hillert
5c719a4646 AMQP-83 - Add Gradle Support
AMQP-83 Reference Doc + JavaDoc fixes - Dist fixes

* Use Docbook XSDs rather than DTDs --> substantial speedup
* For Java Doc follow the same structure as Spring Integration
* Make sure the distribution package's files match the files from the Maven build, e.g. Schema files, license files etc

AMQP-83 - Rename src/docbkx to src/reference
* Remove src/dist/distribution.xml

AMQP-83 Gradle Conversion - Cleanup

* Delete unnecessary Docbook resources
* Update Wrapper to Gradle 1.0 RC3

AMQP-83 - Remove Mavem POM files

AMQP-83 - Update Spring version to 3.0.7 as per AMQP-238

AMQP-83 Rebase with latest commits from master (After 1.1.1 release)

AMQP-83 Code Review

* Remove Bundlor Plugin
* Update README.md
* verify created *pom.xml* files after *gradle install* execution that dependencies match
* ensure that *dist* task is executed by default
2012-06-19 11:09:34 -04:00
Dave Syer
37952790a8 [maven-release-plugin] prepare for next development iteration 2012-05-31 16:40:23 +01:00
Dave Syer
38630d84a2 [maven-release-plugin] prepare release 1.1.1.RELEASE 2012-05-31 14:51:42 +01:00
Dave Syer
7e4897cc17 Update git co-ordinates 2012-05-31 14:51:08 +01:00
Gunnar Hillert
4f3d15e74d Merge pull request #45 from garyrussell/AMQP-204
* garyrussell-AMQP-204:
  AMQP-204 Fix Typo in Class Comment
2012-05-30 13:32:18 -04:00
Gary Russell
93d4abcef7 AMQP-204 Fix Typo in Class Comment
Reference to JMS Vs. Rabbit.
2012-05-30 12:43:14 -04:00
Gunnar Hillert
e66aea8205 Merge pull request #43 from garyrussell/AMQP-239
* garyrussell-AMQP-239:
  AMQP-239 DLE/DLQ Documentation
2012-05-30 12:29:42 -04:00
Gary Russell
574c76224e AMQP-239 DLE/DLQ Documentation
Describe how to invoke Dead Letter Exchange/Dead Letter Queue
routing when rejecting messages in a listener container.
2012-05-30 12:27:49 -04:00
Gunnar Hillert
6160ed05f3 Merge pull request #44 from garyrussell/AMQP-238
* garyrussell-AMQP-238:
  AMQP-238 SF Version 3.0.5 -> 3.0.7
2012-05-30 11:25:25 -04:00
Gary Russell
9a4dffe2ac AMQP-238 SF Version 3.0.5 -> 3.0.7 2012-05-30 11:06:42 -04:00
Gunnar Hillert
37e04506f7 Merge pull request #41 from garyrussell/AMQP-198
* garyrussell-AMQP-198:
  AMQP-198 Document Mixed Queue Arg Types
2012-05-29 23:16:53 -04:00
Gary Russell
38049201e0 AMQP-198 Document Mixed Queue Arg Types
Need to declare the type when setting non-string arguments,
such as x-message-ttl.

Add test showing how to configure a map of mixed types.
2012-05-29 23:14:24 -04:00
Gunnar Hillert
176733d074 Merge pull request #40 from garyrussell/AMQP-237
* garyrussell-AMQP-237:
  AMQP-237 Remove JavaDoc Warnings
2012-05-29 23:08:18 -04:00
Gary Russell
60900baf3d AMQP-237 Remove JavaDoc Warnings
Fix white space
2012-05-29 23:06:53 -04:00
Oleg Zhurakousky
d60f069439 Merge pull request #39 from garyrussell/AMQP-236
* AMQP-236:
  AMQP-236 Remove DOS Newlines
2012-05-24 10:48:09 -04:00
Gary Russell
662ea5caeb AMQP-236 Remove DOS Newlines
Some files had DOS Newlines (CRLF) instead of Unix (LF).

Use 'git log -p -b' to verify only white space changes.
2012-05-24 10:47:19 -04:00
Oleg Zhurakousky
50f428824e Merge pull request #38 from garyrussell/AMQP-232
* AMQP-232b:
  AMQP-232 Failing Tests (Timeout)
2012-05-24 10:46:19 -04:00