Commit Graph

2293 Commits

Author SHA1 Message Date
Gary Russell
a127a46083 INT-2825 Remove Temporary 2.2. Interface
AbstractTransactionSynchronizingPollingEndpoint was introduced late in the 2.2 release process to avoid a breaking change to AbstractPollingEndpoint. For 3.0, its methods are now pulled-up into APE.

Further change:

* remove Deprecated Setter (PollerMetadata)
* fix failing test
2013-02-04 17:40:56 -05:00
Gary Russell
451beb424a INT-2873 Create 3.0 Schemas
Copy schemas, cleanup whitespace, update spring.schemas files,
update version in AbstractIntegrationNamespaceHandler.

For each schema compared the 2.2 version with the 3.0 version
(diff -w), ensuring the only difference is the import of
3.0 schemas (where appropriate) instead of 2.2.
2013-01-25 16:12:00 -05:00
Gary Russell
d928105ef1 INT-2894 Do Not Leak ThrowableHolderException
The AbstractRequestHandlerAdvice uses an internal wrapper for
Throwable, in a similar fashion to the TransactionInterceptor.

Exceptions are unwrapped properly when exiting the invoke method so
callers are unaware of the wrapping.

The technique is used to avoid user errors (for example catching OOM
Errors and not propagating). User code (subclasses) only catch
Exceptions.

However, in the case of the ExpressionEvaluatingRequestHandlerAdvice,
the exception is included in any ErrorMessage sent to a failureChannel.

User code should not have to navigate these internal exceptions within
the cause tree.

Add a method to the abstract class unwrapExceptionIfNecessary, which
will unwrap the root cause exception if possible.

Add a method to the abstract class unwrapThrowableIfNecessary, which
will unwrap the root cause Throwable if possible.

Update tests to reduce the cause() traversals to reflect the
ThrowableHolderExceptions are no longer in the tree.

Add a test to verify a Throwable (such as an OOM) is properly
propagated.

Add a test to verify that when the root cause is a Throwable (and not
an Exception), the ErrorMessage sent to the failureChannel does not include
the ThrowableHolderException.

qualified inner class @links (when merging)
2013-01-23 17:26:20 -05:00
Gary Russell
3902c96a20 INT-2874 Fix JSON/JMS Incompatibility
2.2.0 changed ObjectToJsonTransformr to add content-type to
simplify AMQP applications.

However, in a JMS environment, the DefaultJmsHeaderMapper attempted
to map (and failed) to map the header, emitting a warning log entry.

JMS does not allow '-' in property names.

Add code such that:

1. If the ObjectToJsonTransformer is configured to use a
content-type of an empty String (after trimming), suppress the
addition of the header to the output message. For consistency, if
the inbound message already has a content type header, and the transformer
is configured with an empty String, remove the header.

2. Change the DefaultJmsHeaderMapper to map the MessageHeaders.CONTENT_TYPE
header (content-type) to/from a JMS compliant property name (content_type).

INT-2874 PR Comments

Move constant to JmsHeaderMapper interface and rename.

Fix failing test (explicit set content-type to "").

INT-2874 Documentation Updates

Add docbook and schema documentation clarifying the behavior
of the transformer with respect to setting the `content-type`
header.

INT-2874 Polishing - Remove Header Removal

After further discussion, we decided to not remove an
existing header, if 'content-type' is set to "".

This is because there was no way to handle the case of
NOT adding a header when none present, while retaining a
header if it was already present.

added test for empty content-type attrib and no existing header (while merging)
2013-01-23 13:00:42 -05:00
Gary Russell
1e9581b3a5 INT-2889 Fix Concurrency Problem in Type Converter
In the BeanFactoryTypeConverter, when falling
back to a PropertyEditor (when the source is non-
String and the target is String), the setValue() and getAsText()
methods are used.

This is not thread-safe and one thread might get another's
converted value.

Synchronize the use of the PropertyEditor.

Add test, that reliably reproduces the problem, to verify the
fix.
2013-01-18 15:31:21 -05:00
Gary Russell
dd6af7b387 INT-2864 Enforce Ref/Expression Mutual Exclusivity
Delegating consumer endpoints (<service-activator/> etc)
may not have both 'expression' and 'ref' attributes.
Previously, 'expression' was ignored when 'ref' was present.

- Enforce mutual exclusivity in AbstractDelegatingEndpointParser.
- Add tests for illegal combinations.
- Improve error message when 'method' used with <expression/>.
- Change parser to use reader.error() instead of Assert.
- Add element description to all parser errors.
2013-01-18 11:56:00 -05:00
Gary Russell
e64a167479 INT-2885 Remove DOS Newlines
MessageGroupStoreReaper
2013-01-16 13:37:22 -05:00
Artem Bilan
03053a8450 INT-2880 Fix System.out Concurrent Race Condition
Gradle may run tests using multiple threads.

Using shared resources (e.g. `System.out`) may produce concurrency issues.

* Remove usage of `System.out`
* Add mocking around `LoggingHandler#messageLogger`.

JIRA: https://jira.springsource.org/browse/INT-2880
2013-01-16 13:10:54 -05:00
Artem Bilan
2a419ba6d8 INT-2878: MessageGroupStoreReaper's Lifecycle Fix
`MessageGroupStoreReaper` continues to expire `MessageGroups` via `scheduled-task`
when not `running`.

* Add check `isRunning()` to `run()` & `destroy()`
* Additional `MessageGroupStoreReaper` polishing
* Add test-case

JIRA: https://jira.springsource.org/browse/INT-2878

INT-2878: Polishing : PR Comments
2013-01-16 12:54:22 -05:00
Artem Bilan
a994b40b47 INT-2858: Fix for Repeatable invocation.proceed()
Heretofore there wasn't ability to make some scenario like this, when we want to make failure notification on each retry:

<service-activator>
  <request-handler-advice-chain>
      <bean class="org.springframework.integration.handler.advice.RequestHandlerRetryAdvice"/>
      <bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice"
	    p:onFailureExpression="#exception" p:failureChannel-ref="errorOnEachRetryChannel"/>
  </request-handler-advice-chain>
</service-activator>

The second Advice was invoked only once. This was because `ProxyMethodInvocation` keeps the index of current interceptor
on each `invocation.proceed()`, which is recursive by design.

So, change `AbstractRequestHandlerAdvice` to use `((ProxyMethodInvocation) invocation).invocableClone().proceed();`
This way, we get a fresh `MethodInvocation` for the current `Advice` with nested desired advices.

JIRA: https://jira.springsource.org/browse/INT-2858

INT-2858: Polishing; PR Comments

Introduce `AbstractRequestHandlerAdvice.ExecutionCallback#cloneAndExecute()` especially for repeatable Advices, e.g. `RequestHandlerRetryAdvice`
to avoid overhead from `clone()` on simple Advices

INT-2858: Doc ExecutionCallback#cloneAndExecute()

INT-2858 Polishing

Rework docs; add Javadoc; add to test case.
2013-01-16 12:04:03 -05:00
Stefan Ferstl
f9aea7d5f5 INT-2863 Add Release Strategy to Resequencer
- allow the configuration of release strategies on resequencers
-- adjust the xsd to allow the definition of a release strategy
-- move release strategy parsing to AbstractCorrelatingMessageHandlerParser
-- add unit tests

For reference see: https://jira.springsource.org/browse/INT-2863

INT-2863 Polishing

Fix white space; add @author; update copyright.

INT-2863 Resequencer/Aggregator Docs

Add docs for correlation and release strategis to Resequencer.

Add *.expression docs to Aggregator.
2013-01-15 13:04:56 -05:00
Artem Bilan
2bc3ecb9d7 INT-2845: Gradle: Check XSD Versions in Tests
In many cases IDEs import into test configs Namespace-resources
with hardcoded versions of Spring & Spring Integration XSDs.

This may produce build issues with different Spring versions.

It also causes an issue during the transition to a new Spring Integration version (e.g. 3.0).

* Add Gradle task 'checkTestConfigs' to check test configs for hardcoded resources' versions.
* Add to 'test' task dependency on new task 'checkTestConfigs'
* Fix hadrcoded versions in the test configs.

JIRA: https://jira.springsource.org/browse/INT-2845
2013-01-14 10:45:03 -05:00
Gary Russell
3d0ffd2e7b INT-2833 Fix Test Race Condition
Empty message group expiry used a < test instead of <=. This caused
the group in the test to be not deleted when it was expected to be.
2012-11-30 15:56:21 -05:00
Gary Russell
3ea05576b3 INT-2832/2833 Aggregator Fix and Documentation
Expire empty groups.

Due to indentation changes, the code changes look more extensive
than they are. In effect the if (group.size() > 0) test is moved
to a narrower scope and the remove(group) is now performed if the
group is empty.

Document expire-groups-upon-completion.

INT-2832 Doc Polishing

PR Review + punctuation.

INT-2833 Add Delay For Expiring Empty Groups

minimumTimeoutForEmptyGroups
2012-11-30 15:31:36 -05:00
Gary Russell
c4a4b59848 INT-2828 Remove Package Tangle
* Remove Class Tangle in JPA
* tcp.connection
* tcp.connection.support
* Add Comment to MessageGroupCallback
  - Comment that it is moving into MGS in 3.0.
  - Convert DOS newlines to Unix.

For reference see: https://jira.springsource.org/browse/INT-2828
2012-11-21 17:44:02 -05:00
Gunnar Hillert
1709028d14 INT-2686 MessageGroupQueue Optimization
INT-2826 - Minimize calls to MessageGroupQueue.size() when infinite capacity
For reference see: https://jira.springsource.org/browse/INT-2826

INT-2826 - Code Review Changes
2012-11-21 09:25:23 -05:00
Gary Russell
6f4800a904 INT-2815 Refactor AbstractPollingEndpoint
Recent changes to APE were sub-optimal because the subclasses
had to call back into the parent abstract class.

Deprecate doPoll() on APE.

Introduce a temporary intermediate abstract class that supports
transaction synchronization.

This class will be deprecated in 3.0.0 when its methods will
be pulled up into APE.

INT-2815 Polishing

Make ATSPE package visibility.

Add helpers to enable early migration to 3.0 structure.

INT-2815 Polishing

Fix javadoc to emphasize that doPoll() will no longer
be overridable in 3.0.

Rename doReceive() to receiveMessage() to match more closely
with handleMessage().

INT-2815 Polishing

Fix message in UnsupportedOperationException.
2012-11-20 19:54:21 -05:00
Gary Russell
bcce3277e5 INT-2815 Support Tx Synch In Pollable Consumers
Pull transaction synchronization code up from SPCA
to AbstractPollingEndpoint, providing support for
transaction synchronization in PollingConsumer.

Also, ensure headers are copied to any message generated by the
ExpressionEvaluatingTransactionSynchronizationProcessor.
2012-11-14 01:19:47 -05:00
Mark Fisher
985374ca69 INT-1812 eliminated package cycles 2012-11-07 15:50:00 -05:00
Artem Bilan
4dfbcf9777 INT-2777 TxSynchFactory: tests for bound resource 2012-10-19 10:27:24 -04:00
Artem Bilan
eb1500cb7e INT-2773: Fix AmqpOutboundEndpoint's properties
* make `AmqpOutboundEndpoint` 'exchangeName' & 'routingKey' **null** by default
* some polishing for `AmqpOutboundEndpoint`
* verification tests for parameters of `com.rabbitmq.client.Channel#basicPublish`

JIRA: https://jira.springsource.org/browse/INT-2773

INT-2773 Polishing - Allow Override to ""

Previously, there was no way to revert to the previous
behavior by specifying an empty string for the attribute(s).

Add test to verify setting attributes to "" overrides template.
2012-10-11 18:36:15 -04:00
Oleg Zhurakousky
8c43c59c03 INT-2777 TransactionSynchronization
Ensured that bindings of the resource only happen if TransactionSynchronizationFactory is not null
Add documentation describing the expectation for the unbinding of the resource.

INT-2777 Polishing

Don't set up holder if it's not used.

Doc fixes.
2012-10-11 17:46:45 -04:00
Gary Russell
8733350c43 INT-2781 Retry Advice; Fix Recovery For Zero Tries
Retry Advice (ErrorMessageSendingRecoverer) tried to send a message
with a null payload when the RetryPolicy allowed zero attempts.

Create a MessageHandlingException with the failedMessage, when
no attempts were made to call the handler.
2012-10-11 14:56:39 -04:00
Gary Russell
53fd816828 INT-2767 Remove Unused Test Config
Obsolete file left over from a previous implementation
of tx synchronization.
2012-10-10 18:56:45 -04:00
Artem Bilan
82d234d543 INT-2770 & INT-2771 fixes:
* INT-2770: fix for 'txAdviceChain' in the`AbstractJpaOutboundGatewayParser`
* INT-2771: make `AbstractReplyProducingMessageHandler.RequestHandler` public

JIRAs:
https://jira.springsource.org/browse/INT-2770
https://jira.springsource.org/browse/INT-2771
2012-10-09 16:23:01 -04:00
Gary Russell
2340e6f442 INT-2763 Send AdviceMessage from Advice
The ExpressionEvaluatingMessageHandlerAdvice now sends an
AdviceMessage which has a payload of the original message, and
a property 'inputMessage' referencing the message that was
sent to the advised handler.

INT-2763 Expression Advice Reference Doc Update

Update to reflect the new behavior.
2012-09-21 14:08:40 -04:00
Gunnar Hillert
7055845424 INT-2218 - Chain Parser Validation Improvements
Components within Chain: Add parser validation

For reference see: https://jira.springsource.org/browse/INT-2218

INT-2218 - Code review changes

INT-2218 - Fix HttpOutboundGatewayParserTests

INT-2218 - Remove input-channel validation

Was already covered by PR #592
2012-09-21 12:22:52 +01:00
Gary Russell
49a6079d1a INT-2683 Add Reply Listener Container Option
INT-2683 Tests

Expanded JMS Gateway Tests

INT-2683 First commit

Listener Container Option for Replies

INT-2683 Remove no correlation-key Option

INT-2863 Support DestName and Temp Dest

INT-2683 Add back Support No CorrelationKey

INT-2683 Fix Tests

INT-2683 Polishing

Fallback if no correlationKey and fixed reply queue.

INT-2683 Polishing

Change from SMLC to DMLC

INT-2683 Polishing

Since we changed to DMLC, we can now remove the check for
SingleConnectionFactory.

INT-2683 <reply-listener/> Namespace Support

Add <reply-listener/> subelement to JMS Outbound Gateway.
2012-09-20 21:22:11 -04:00
Gary Russell
de938cec27 INT-2751 Jdbc Message Store Group Id Issues
Jdbc Message Store always converts the correlation id
to a UUID string, even if it's already a String.

This causes reaper issues with the correlating message
handler because the reap occurs under
a different lock to normal group processing.

This change ensures the lock is properly mutually
exclusive.
2012-09-19 15:38:07 -04:00
Oleg Zhurakousky
ee91a6ce5a INT-1819 Mail pseudo-tx support
Added pseudo-tx support for Mail inbound adapters
For polling adapters no changes have been made other then returning a javax.mail.Message instead of its copy so
post-tx dispositions could be performed on it.
For Imap IDLE adapter changes are simiar to the once present in SPCA where TX synchronization logic was added to ImapIdleChannelAdapter
Couple of things to note:
First IDLE receives an array of messages while Polling task receives one message which means i need to sendMessage in the Polling task in the separate thread, so for maintaining single thread semantics we have now it uses single thread executor to send Messages
Renamed MSRH to TransactionalResourceHolder since we no longer use 'source' anywhere and in the case of IDLE there is no MessageSource. Its is truly a holder of attributes we want to make available for use (e.g., SpEL)

INT-1819 Polishing

- Change TransactionalResourceHolder to IntegrationResourceHolder
- Make messageSource available as an attribute
- Allow configuration of Executor for ImapIdle adapter
- Add parser test for TX ImapIdle adapter
- Fix bundlor config for mail
- Remove top level <transactional/> element that was added to core
- Restore 'legacy' mail attributes in TX, and add schema doc

INT-1819 Mail TX Reference Docs

Add reference documentation for mail transaction support.

INT-1819 Remove 'public abstract' from interface

Modifiers are not needed on an interface.
2012-09-19 12:12:31 -04:00
Gary Russell
913a8058dd INT-2751 Fix Reaper Race Condition
When the reaper runs, and finds a group that is in the
process of being completed, the reaper blocks on the
lock, but when the lock is released, goes ahead and
reaps the group.

Now, after obtaining the lock, the reaper checks to
see if the modified date changed and, if so, aborts
the reap of the group this time around.

Required adding lastModified accounting for SimpleMessageGroup
(accounting already exists for other message groups).

Test case reproduced the problem, demonstrating duplicate
output messages.

After the fix, it shows the reap was aborted in the debug
log.

INT-2751 Polishing

PR Comments
2012-09-18 09:52:09 -04:00
Gary Russell
2959db8631 INT-2748 Change CircuitBreaker Exception
Previously, when the breaker was open, it threw a
MessagingException. This was not wrapped so normal
error-channel processing 'payload.cause.message'
failed because the cause was null.

Change the exception to a new private
CircuitBreakerOpenException.
2012-09-18 09:06:20 -04:00
Gary Russell
1d03acbc31 INT-2750 Fix GatewayProxyFactoryBean Javadoc
Default serviceInterface is RequestReplyExchanger.
2012-09-14 12:21:51 -04:00
Artem Bilan
31d0e42c1a INT-2718 & INT-2721: fixes for <chain> & fix bugs
* ban to use 'channel' and 'request-channel' attributes for 'outbound-channel-adapters' and 'outbound-gateways' when they are declared inside the `<chain>`
* fix usage of `<request-handler-advice-chain>` for components when they are declared inside the `<chain>`
* ban to use `<request-handler-advice-chain>` for 'outbound-channel-adapters' when they are declared inside the `<chain>` don't implement `AbstractReplyProducingMessageHandler`
* refactor `IntegrationNamespaceUtils` to use `BeanDefinition` instead of `BeanDefinitionBuilder` for 'advice-chain' parsing
* tests for new logic for 'channel' and 'request-channel' attributes within `<chain>`
* tests for new logic for `<request-handler-advice-chain>` within `<chain>`
* fix failed test on slow machine
* fix `SysLogTransformer` tests

For reference:
https://jira.springsource.org/browse/INT-2718
https://jira.springsource.org/browse/INT-2721
https://jira.springsource.org/browse/INT-2719

INT-2718 Polishing
2012-09-10 16:13:45 -04:00
Gary Russell
8d887df44f INT-2698 Reference Docs for Handler Advice
INT-2698 Doc Retry Initial Commit

INT-2698 Doc Circuit Breaker

INT-2698 EERHA

INT-2698 Custom Advice

INT-2698 Polishing

INT-2698 Polishing (PR Review)
2012-09-07 10:18:14 -04:00
Oleg Zhurakousky
108baedd53 INT-2737 RedisMessageStore Fix
Fix RedisMessageStore to ensure that it
strips prefix from keys wheh they are returned
via iterator().

INT-2737 polishing

INT-2737 polishing
2012-09-06 16:00:37 -04:00
Gary Russell
c6f27d5b22 INT-2727 Fix JavaDoc Warnings
Previous push introduced a few JavaDoc issues.
2012-09-05 17:33:39 -04:00
Oleg Zhurakousky
94cc5a73e2 INT-2727 PseudoTX Refactoring
Remove the need for pseudo-transactional element

INT-2727 PseudoTX
Add PseudoTransactionalTransactionManager

INT-2727
addressed PR comments
cherry picked previous code for mail module to eliminate breaking change

INT-2727
initial refactoring pseudo-tx support to use common configuration

INT-2727
finalizing pseudo-tx synchronization support

INT-2727 polishing

INT-2727 polishing based on PR comments

INT-2727 addressed PR comments

INT-2727 polishing

INT-2727 Remove PseudoTransactionalMessageSource

Instead of getResource, bind the resource holder before
receive() and then add attributes to the holder.

INT-2727 polishing

INT-2727 Polishing

Remove bind of #resource; add beforeCommit() test;
add TransactionTemplate tests.
2012-09-05 16:55:34 -04:00
Gary Russell
273bba370b INT-2730 Move OrderlyShutDownAware Interface
Move from core to context.
2012-08-31 17:57:33 -04:00
Gary Russell
92959b3e06 INT-2716 Fix Javadoc Warnings 2012-08-29 14:07:17 -04:00
Gunnar Hillert
dad4eac9ac INT-2710 - Remove hard-coded schema references
For reference see: https://jira.springsource.org/browse/INT-2710
2012-08-28 17:08:43 -04:00
Artem Bilan
600a347652 INT-2722: Document Delayer's <advice-chain>
* describe delayer's `<transactional>` & `<advice-chain>` abilities
* polishing delayer's doc: it looks bad in the PDF
* fix typo for 'proxying'

JIRA: https://jira.springsource.org/browse/INT-2722

INT-2722: Polishing - PR comments
2012-08-28 16:59:47 -04:00
Oleg Zhurakousky
6528574c7e INT-2713 AMQP Content-Type Mapping
Adjusted DefaultAmqpHeaderMapper to recognize and convert Content-Type
to String if the incoming Content-Type headers is of type
org.springframework.http.MediaType.

INT-2713 polishing
2012-08-15 18:51:31 -04:00
Oleg Zhurakousky
246a202661 INT-2626 Fix RLR parser
Fix RecipientListRouterParser to extend
from AbstractRouterParser, thus eliminating
the problem described in INT-2626.

Previously, the router was a top level bean and, since
it is an @ManagedResource, the mbean exporter eagerly
instantiated it (and its Recipients) before the
ChannelInitializer ran.

Now, it is an anonymous inner bean inside a FB,
so the exporter no longer "finds" it,
thus deferring the Recipient instantiation
until the router itself is instantiated via its FB,
which will be after the C.I. runs.

This is all fine, with one caveat - previously the RLR
is made available as an MBean - now it is not,
unless you ALSO add the int-jmx:mbean-exporter.

However, the MBean is very basic, with no attributes and
a single operation 'setShouldTrack()', so the risk is
extremely low and the workaround is to add the
IntegrationMBeanExporter.

INT-2626 polished based on PR comments
2012-08-14 15:21:20 -04:00
Gary Russell
f8782f3dc9 INT-2711 syslog Transformer
Initial Implementation; UDP test.

syslog - Add TCP Test

Add single byte terminating deserializer and a
subclass that terminates on LF (syslog uses
LF terminator).

Move to Core

Allow for transport of undecoded packet over, say, AMQP.

INT-2711 Syslog Transformer

PR Comments; Polishing.

Remove List option; support to-map version only.
2012-08-14 14:15:21 -04:00
Gary Russell
89d2f3ad83 INT-2704 Exception Processing in TCP Adapter
When using an outbound adapter with a server connection factory
(an inbound adapter 'owns' the connections), the outbound adapter
simply logged exceptions.

There are use cases where flows need to know the exception occurs.

Change the adapter to throw a MessagingException.

Update the 2.1 to 2.2. Migration guide explaining that the
ExpressionEvaluatingRequestHandlerAdvice can be used to restore
2.1 behavior, and trap the exception.
2012-08-12 11:22:31 -04:00
Gary Russell
3feef9414a Merge pull request #570 from olegz/INT-2638 2012-08-10 16:41:58 -04:00
Oleg Zhurakousky
bfb5cbdb2a INT-2638 added support for Redis inbound channel adapters
Currenly there is support for:
- list-inbound-channel-adapter - http://redis.io/commands#list
- zset-inbound-channel-adapter - http://redis.io/commands#sorted_set

INT-2638 polishing

INT-2638 polished schema docs

INT-2638 polishing

INT-2638 polishing

INT-2638 refactored Redis collection inbound adapters to use RedisStore (view)

INT-2638 polishing, exposed redis-template via the namespace

INT-2638 polished based on PR comments

INT-2638 polishing

INT-2638 Polishing
2012-08-10 16:26:24 -04:00
Gunnar Hillert
ef1c0fc93d INT-2392 - ChainElementsFailureTests reads wrong 'xmlheader' property
For reference: https://jira.springsource.org/browse/INT-2392

Code Review - Refactored Test Case
2012-08-10 07:46:40 -04:00
Gary Russell
1405e3bbf0 INT-2703 SpEL-Based Retry State Generator
Stateful retry requires some state to determine the
retry count for a resubmitted message.

State is provided by a retry state object generated by a
state generator. No standard state generators were
provided by Spring Integration.

Provide a SpEL-Based state generator to create a
RetryState object from a Message (for example, using
the jms message id header).

Add ErrorMessageSendingRecoverer - a RetryCallback
invoked when recovery attempts are exhausted.

Add string-based constructor to Spel Advice for
easier <bean/> configuration.
2012-08-09 17:30:15 -04:00