Commit Graph

7448 Commits

Author SHA1 Message Date
Gary Russell
76de60c2b5 Revert Version to 3.0.0.BUILD-SNAPSHOT 2013-09-05 11:25:58 -04:00
Spring Buildmaster
47a405a832 [artifactory-release] Release version 3.0.0.M3 2013-09-05 07:49:22 -07:00
Gary Russell
4abeebdb3a INT-3132 Add minSubscribers to Pub/SubChannel
Send is deemed to be successful if sent to at least this
number of subscribers (default 0).

Note: when using a task executor, if there is at least one
subscriber, a send is always good, regardless of success
or failure of invoking the handler.

Polishing - Docs - PR Comments
2013-09-05 09:12:17 -04:00
Eric Bottard
e24d683478 INT-3122 Return String Properties as String
Make converted object toString() behave as expected
2013-09-04 22:59:18 -04:00
Artem Bilan
93f61160e2 INT-1639: Add <spel-function> support
* add `<spel-function>` XSD element
* add `SpelFunctionParser`
* add `SpelFunctionRegistrar` to avoid introducing some confused 'Method'-bean
* add `SpelFunctionRegistrar` collaboration with `IntegrationEvaluationContextFactoryBean`
* some refactoring for `IntegrationEvaluationContextFactoryBean`
* polishing some failed tests after this change

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

INT-1639: SpelFunctionParser use BeanClassLoader

INT-1639: Inherit 'functions' from parent AC

INT-1639: Document the <spel-function>

INT-1639: 'NoSuchBeanDefinitionException' fix

Polishing
2013-09-04 18:43:00 -04:00
Gary Russell
1705a70def INT-3114 Call MessageHandlers Directly
Invoke ARPMH Directly (SA, Splitter etc)

If a bean referenced by a service activator etc, is already an ARPMH,
then wire it directly into the endpoint rather than wrapping it in a
MethodInvoking Handler.

Disallow the same bean being used in this way in multiple endpoints.
It would cause rewiring of outputChannel etc.
Detect such use and suggest using prototype scope.

Previously, an ARPMH used in a MethodInvokingHandler didn't work
in some cases, because the "inner" ARPMH had no output-channel
and the outer ARPMH (e.g. transformer) wouldn't get a reply and
would complain if requiresReply is set.

The general solution is to detect the ARPMH targetObject in
AbstractStandardMessageHandlerFactoryBean, invoke canBeUsedDirect()
to allow the subclass to vote - specifically it will be allowed
if the type is not also a special type understood by the subclass
and no endpoint-specific attributes are set.

To this end, remove a few default attributes from the schema to
enable detection of explicit setting of these attributes.

If these conditions pass and the method is handleRequest (either
explicitly or by omission) then wire it in and invoke the
subclass to post process the handler (set attributes).

Restructure this post processing in each subclass so that it can be invoked in
this way, or directly by the subclass when it makes a custom
handler.

Polishing - PR Comments

Mainly a little refactoring in the RouterFactoryBean to allow
the parameter in canBeUsedDirect() to be an ARPMH instead of
Object.

Plus a couple more minor changes.
2013-09-04 17:07:01 -04:00
Gary Russell
81ac7e56be INT-3124 JMX Check Mutually Exclusive Attributes
Only one of query-name and query-name-ref
Only one of query-expression and query-expression-ref
2013-09-03 18:49:54 -04:00
Artem Bilan
98b42cbe36 INT-3070: Fix Delayer with MongoDbMessageStore
The `DelayHandler.DelayedMessageWrapper` works correctly, as designed by INT-3049.
However `DelayHandler.DelayedMessageWrapper` contains `Message` as a property
and `GenericMessage` can't be reconstructed automatically.

So, added new `DBObjectToGenericMessageConverter` to read `GenericMessage` for
`DelayHandler.DelayedMessageWrapper#original` property.

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

Cherry-picked 2.2.x

INT-3070: PR comments

INT-3070: Remove `assert` for common state
2013-09-03 18:15:02 -04:00
Gunnar Hillert
16cb95fedd INT-2917 Doc: Add "Requirements" Chapter
Also addresses:

* INT-3128 Remove old SpringSource logo

INT-2917 Fix versions

INT-2917 Polishing

INT-2917 Fixed wording
2013-09-03 14:55:29 -04:00
Gary Russell
99fa064dda INT-3124 Make Test Domains Unique
Gradle build failed with InstanceAlreadyExistsException.

Make domains unique in new tests and the one that failed.
2013-09-03 13:58:02 -04:00
Pid
5212ea13ef INT-3124 Add JMX MBean Tree Inbound Adapter
Add an MBeanTreePollingMessageSource that produces a graph of simple objects representing the JMX tree (INT-3124).

The DefaultMBeanObjectConverter converts MBean objects into a graph of Lists, Maps and arrays or primitives.

Formatting tidy, per feedback.

Feedback incorporated: split setter/attributes, more tests, inner bean constructor, logging changes.

Overloaded setter methods with different parameter types are now named separately, the endpoint attributes reflect this and tests are added to reflect this.

An inner bean can be supplied to provide an alternative MBeanObjectConverter.

Log a warning instead of a more destructive UnsupportedOperationException where there's incomplete parsing in the DefaultMBeanObjectConverter and add a trace level for exception debugging.

Minor test change and doc/reference update

Added attribute filter interface as suggested. Three implementations are provided 'all', 'named only' and 'not named'

actually add notnamedfield filter (doh).

Polishing
2013-09-03 13:06:01 -04:00
Artem Bilan
35e8929f1c INT-3131: Compatibility with SPR 4.0
Polishing tests to follow with new changes in the SPR 4.0
Polishing build.gradle to be compatible with SPR 4.0

Build passes with SPR 3.2.4 too

JIRA: https://jira.springsource.org/browse/INT-3131
2013-09-03 11:08:08 -04:00
Gary Russell
693a1e17a0 INT-3119 Add Documentation Re SpEL Customization
- Custom PropertyAccessors
- Custom Functions

Polishing - PR Comments
2013-09-03 10:15:54 -04:00
Gary Russell
8f182a2be8 INT-3122 Polishing - Fix Deprecated Jackson2 Call
createJsonParser -> createParser

Also remove some unused imports in MapMessageConverter
2013-09-02 14:15:09 -04:00
Eric Bottard
e6e18ef8f2 INT-3122 Add JsonPropertyAccessor
Requires Jackson2

Bump Jackson2 version

Remove write support

Add String support

Polishing

Initialize objectMapper field; assert ObjectMapper is not null.

Newlines at ends of files.
2013-09-02 13:41:58 -04:00
Gary Russell
db8da81d16 INT-3125 Fix Handler MBean Names Within Chains
Some handlers get a componentName, but not a beanName. For example
the TransformerFactoryBean may create a Transformer that's not
a bean, to wrap a POJO, or expression. The AbstractSimpleMessageHandlerFactoryBean
transfers the component name to the transformer but it has a null
beanName. It would not be appropriate for the FB to change the beanName.

The IntegrationMBeanExporter's fallback, when it can't find the handler
as part of a stand-alone endpoint, is to use the handler's toString().

IntegrationObjectSupport (IOS) toString delegates to Object.toString()
if there is no beanName.

IOS's getComponentName() falls back to the beanName if there is no
component name.

Change the IMBE to use the componentName as the first fallback and,
if null, fallback to the current fallback.

One side effect is that handlers that do have a bean name
will no longer have '.handler' at the end of their name; but this
is not really an issue because the MBean is designated as a
handler anyway (via the bean component of the ObjectName).

However, identifying chain components is new in 3.0 so this is
not really a breaking change.
2013-09-01 10:08:42 -04:00
Gary Russell
b63768ec32 INT-2995 Fix Leftover Docbook Conflict Marker 2013-08-30 19:05:36 -04:00
Artem Bilan
4609b861d1 INT-2995: Fix HttpHeaders inconsistency
Previously, 'If-Modified-Since' and 'If-Unmodified-Since' HTTP headers were incorrectly processed
within from/to HTTP headers mapping, because Spring-Web `HttpHeaders` has a confusing method name, see:
https://jira.springsource.org/browse/SPR-10600

* fix 'If-Modified-Since' and 'If-Unmodified-Since' processing independently from `HttpHeaders`
* add fallback to formatted string for date ware HTTP headers
* add Spring Integration HTTP proxy scenario test

JIRA: https://jira.springsource.org/browse/INT-2995
2013-08-30 16:28:14 -04:00
Gary Russell
9285867465 INT-3123 TCP Fix Error Propagation with Failover
The second chance NIO logic that detects a close being received
in a race condition with a reply needs to be enabled always because
a Failover or Caching connection factory might be using NIO
underneath.

Also, add an epoch to the FailoverTcpConnection's connectionId which
is incremented on each use to prevent a close after a previous
use being received by the current user.

Finally, add code in the FailoverTcpConnection to not propagate
messages from an old (defunct) delegate connection - if the
delegate has changed, the connection must be being used by
another client.
2013-08-29 14:51:44 -04:00
Eric Bottard
7dabe1334c Fix Reference Manual Typo 2013-08-29 09:59:27 -04:00
Gary Russell
613861925e Replace CR with LF - Bad File Format 2013-08-28 00:31:38 -04:00
Gary Russell
02a82d6eaa INT-3115 One EvaluationContext FB Per Context
Move definition of the IntegrationEvaluationContextFactoryBean
from DefaultConfiguringBeanFactoryPostProcessor to
AbstractIntegrationNamespaceHandler.

We need a separate eval contexts for each app context so that child
contexts get the correct BeanResolver.

Add Test For IECFB and Parent Context
2013-08-27 11:12:55 -04:00
Gary Russell
52b340956f INT-3115 Fix EvaluationContext Initialization
There were several "helper" classes where the context was initialized
in the constructor, before the BeanFactory was passed in.

Generally fixed by adding the BeanFactory to the constructor args.

Other cases where the container-managed bean instantiated a helper
and never passed in the BeanFactory.

Finally, a fix to ExpressionUtils where the caller had a BeanFactory
but the BF did not contain an EvaluationContext factory bean, the
BeanResolver was not set up. This is unlikely in a Spring Integration
application, but added for completeness.

INT-3115 Add a BeanFactory to Test Cases

Change the WARN log in ExpressionUtils to a fatal exception to detect
cases where an EvaluationContext was created without a BeanFactory.

While this was generally in test cases, it also exposed some cases
in code where the context was initialized without a BF.

polishing on merge
2013-08-27 00:28:00 -04:00
Gary Russell
06b06b1c8f INT-3103 Fix Connection Timeout Tests
Test cases could occasionally fail because an ErrorMessage is
now returned to the listener.
2013-08-26 22:01:24 -04:00
Gary Russell
943ad33a3f Remove DOS Newlines from ECMP
ExpressionCommandMessageProcessor
2013-08-26 20:54:00 -04:00
Gary Russell
b5ee5338db Merge pull request #822 from wwadge/INT-3054
* INT-3054:
  INT-3054: Add ExpressionEvalMap Support
  INT-3054 URI Variable Mapping Improvements
2013-08-26 15:40:59 -04:00
Artem Bilan
56812d3861 INT-3054: Add ExpressionEvalMap Support
Use an immutable Map wrapper to evaluate expressions
only when accessed.

Polishing
2013-08-26 15:29:38 -04:00
Wallace Wadge
3369d3f9b1 INT-3054 URI Variable Mapping Improvements
Permit missing URI vars in HTTP outbound gateway

Do not attempt to evaluate uri variables that are not in the URL

The http gateway might not know what uri variables it might obtain in the URI.
This patch makes sure that only the uri variables defined in the uri are parsed (the rest are ignored)
2013-08-26 15:23:07 -04:00
Gary Russell
0301f262e0 INT-3103 TCP Propagate Exceptions to GW Thread
Previously, when a calling thread was waiting for a reply, and an exception
occurred on the socket, the exception was not propagated to the thread and
it would eventually get a timeout, but with no indication of the problem.

Propagate the exception to the calling thread by invoking onMessage()
with an ErrorMessage.

Ignore the ErrorMessage in other TcpListeners (inbound adapter, gateway).

Ensure NIO closes are not missed by sending an ErrorMessage when the selector
thread detects a closed channel.

Add tests for Net, NIO, cached and failover connection factories.

Polishing

Remove left-over debug logs; add comment to setReply().

Add comments for ErrorMessages in onMessage().
2013-08-26 12:20:34 -04:00
Gary Russell
7f008b58c2 INT-1639 Externalize SpEL Evaluation Context
Allow modification of context property accessors and
functions.

Polishing

- Fix tests to ensure the EvaluationContextFactoryBean is
available when necessary.

Polishing - Use Utility for ALL EvaluationContexts

Add Test Showing Custom Function

See SpelTransformerIntegrationTests-context.xml

Polishing

Polishing -fix Remote Sync

Polishing - Emit WARN if No BeanFactory

Polishing - Do Not Override ConversionService

Kludge to Prevent Warning When No BeanFactory

Expressions for method invoking in the MessagingMethodInvokerHelper
don't need a BeanFactory - suppress the warning.

Polishing - PR Comments - Invert Boolean
2013-08-25 20:01:14 -04:00
Gary Russell
351af6b16b INT-3096 TCP Allow Stacking Cache and Failover
Support nesting the fail over and caching client connection
factories.

The TcpListener chain was not set up properly; this prevented
caching Failover connections, or Failover cached connections.

Each nested interceptor needs the next outer interceptor set
up as its listener, so the underlying connection calls
onMessage() all the way up to the ultimate listener (adapter
or gateway).

Fix the Listener hierarchy; add tests for caching failover
connections and failing over cached connections.

Don't overrwrite the actual connection id if it has already
been set up by a lower level wrapper.
2013-08-22 12:02:26 -04:00
Gary Russell
e73a5dc69f INT-3112 Fix OOM in SimplePool
The SimplePool maintains an 'allocated' set, for the sole reason
of preventing a "foreign" (non-managed) object being returned.

When a pool item is detected as stale, it is removed from the pool
but remains in the 'allocated' set.

Add a test to verify the allocated size is reduced when a stale
item is popped from the pool.

Add a FileTransferringMessageHandler test (where the problem was
discovered).

Fix a test in TCP to expect a close().

Polishing

Do not allow returning null items to just release a permit - it
cannot remove the item from allocated. Clients must return the
stale item to the pool so it can be refreshed on the next get.

Only used by the TCP caching CF when returning a connection when
the factory is not running; but should not be allowed.

Also, protect against double release - not currently an issue with
existing users of SimplePool, but should be protected against. Could
cause the permit count to exceed the pool size.

Add inUse Set to the pool so we can detect attempts to release an
item that has already been released.
2013-08-22 10:53:36 -04:00
Artem Bilan
bb71fd8a37 INT-3078, INT-3079: Redis & Gemfire Delayer Tests
Add Redis & Gemfire Delayer integration tests
to be sure that Delayer works correctly

JIRA: https://jira.springsource.org/browse/INT-3078
https://jira.springsource.org/browse/INT-3079
2013-08-21 17:37:10 -04:00
Artem Bilan
afe56ca6d5 INT-2243: Delayer: Add 'expression' Support
Previously, the `<delayer>` provided a `delay-header-name` attribute.
In complex cases there was need to precede it with `<header-enricher>`.

* Add support for an 'expression' attribute and sub-element
* Deprecate `delay-header-name`
* Make `DelayHandler.DelayedMessageWrapper` *public* to allow access for Messages in the Store
* Add tests
* Add 'What's new' section
* Polishing Delayer's doc regarding new abilities

JIRA: https://jira.springsource.org/browse/INT-2243, https://jira.springsource.org/browse/INT-3049

INT-2243: ban delay-header-name with expression

INT-2243 Polishing

INT-2243: fall-back to default on Eval Exception

INT-2243: DelayedMessageWrapper refactoring

* Make `DelayedMessageWrapper` Spring Data Mongo mapping compatible.
In terms of Spring Data - add Persistence Constructor

INT-2243 add 'ignore-expression-failures' support

* Add `ignore-expression-failures` to the `<delayer>`
* Add tests for `ignore-expression-failures`
* Add a note to the RM
* Describe SpEL side-effects for `DelayHandler`

Doc Polishing
2013-08-20 16:54:42 -04:00
David Turanski
67fd4a5a60 INT-3051 Derive Script Language from Extension
Make 'lang' attribute optional on a script element and
attempt to derive the language from the file extension.

Change return value on ScriptParser.deriveLanguageFromExtension to the language name

Polishing (PR Comments)
2013-08-20 14:40:07 -04:00
Gary Russell
573c692957 INT-2994 Advice Chain Config via Annotations
Allow configuration of request handler advice chain using

- ServiceActivator
- Filter
- Splitter
- Transformer

annotations.

Also, with splitter, allow setting discardWithinAdvice (See
INT-2938).

INT-2994 Polishing: PR Comments

- Change adviceChain attribute to an array
- Use a boolean for the discardWithinAdvice attribute

INT-2994 Handler Advice Doc Polishing

Add a paragraph about Advice Order.
2013-08-20 12:10:25 -04:00
Gary Russell
7ea5998016 Fix while Block Formatting in SimplePool 2013-08-20 11:27:10 -04:00
Artem Bilan
83046fcb39 INT-3063: 'Expires' HTTP header workaround
According to RFC 2616 HTTP clients should ignore invalid values
for date-aware header, but Spring MVC `HttpHeaders` raises
`IllegalArgumentException` in this case.
Proposal fix to Spring Integration just to `try...catch` call of
`HttpHeaders.getExpires()` and `return null`.

JIRA: https://jira.springsource.org/browse/INT-3063
2013-08-19 16:59:15 -04:00
Artem Bilan
70886b2543 INT-2822: 'requires-reply' for Outbound Gateways
* Add `requires-reply` attribute for all adapters outbound gateways as `true` by default
* WS-outbound-gateway is still without it, because it has its own specific attribute `ignore-empty-responses`
* Make `requires-reply` as `false` by default for `jdbc:stored-proc-outbound-gateway` inasmuch as `jdbc:stored-proc-outbound-adapter`
doesn't have ability to configure `returning-resultset`
* add parser tests for `requires-reply`

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

INT-2822 'requires-reply' for ws:outbound-gateway

Default false.

INT-2822: Polishing after rebase

INT-2822: deprecate 'ignore-empty-responses'

* Add 'requires-reply' section into What's New

INT-2822: remove 'ignore-empty-responses' from RM

INT-2822: Polishing after rebase

INT-2822: Rebased and polished

INT-2822: Rebased and polished

Add WARN within deprecated `AbstractWebServiceOutboundGateway#setIgnoreEmptyResponses`

Revert 'ignore-empty-responses'; Doc Polishing
2013-08-19 13:48:31 -04:00
Gary Russell
b8980d4064 INT-3111 Fix Close Cached TCP Connection
A TCP Connection is closed when an outbound gateway times out.

However, with the CachingClientConnectionFactory, the connection
was returned to the pool instead of being physically closed.

Override forceClose() and physically close the connection so the
next time it is retrieved from the pool it is detected as stale
and re-established.

Refactor test case and invoke it twice; once with a regular connection
factory and once with a cached factory.

Remove an unused logger.
2013-08-19 12:24:08 -04:00
jodiestjohn
56af118656 INT-3087:Fix MongoDbMessageStore RemoveMessage Bug
Add new query so the same message found in pollMessageFromGroup is the
one which gets deleted.

See jira for more details: https://jira.springsource.org/browse/INT-3087

INT-3087 Polishing

Use an atomic method in pollMessageFromGroup to pop the first message.

Add test cases for pollMessageFromGroup and removeMessageFromGroup
where the same message exists in multiple groups.
2013-08-19 11:34:48 -04:00
Gary Russell
c5355a3417 Fix Syslog Test
Test didn't wait for the TCP server to start listening.
2013-08-19 00:35:23 -04:00
Gary Russell
28943357f4 INT-2901 Add Namespace Prefix
Avoid confusion with the core header enricher.
2013-08-18 23:15:19 -04:00
Gary Russell
d5b607a396 INT-2901 Fix Mail HeaderEnricher Doc
The move from attributes to child elements was not reflected
in the reference manual.
2013-08-18 14:47:51 -04:00
Artem Bilan
41fe514469 INT-3067 Xslt method=text StringResult coercion
Previously there was a need to add `result-type="StringResult"`
to <int-xml:xslt-transformer> for xslt output `method='text'`
in case payload was non-standard type (e.g. `File`), if we wanted to get
result as text.

* Add coercion to `StringResult` code, if `Transformer`'s property `method` is 'text' and there is no explicit `resultFactory` provided.
* Add documentation to reference manual

JIRA: https://jira.springsource.org/browse/INT-3067
2013-08-17 13:17:08 -04:00
Gary Russell
d549734837 Update Maven Dev Info 2013-08-17 09:38:21 -04:00
Gary Russell
c5f311b5c5 Update Project Lead 2013-08-16 22:40:14 -04:00
Gary Russell
0699fdc6cf INT-1807 Add Mechanism For Headers with TCP
TCP streams have no standard message structure. Therefore, the
TCP implementation previously only transferred the message
payload.

If someone wanted to convey header information, they would have
to write their own wrapper and/or use Java serialization for
the entire message.

This change provides a strategy to allow users to determine
which headers are transferred, and how.

A MessageConvertingMessageMapper is now provided that invokes
any MessageConverter. A MapMessageConverter is provided that
converts the payload, and selected heades to a Map with two
entries ("payload") and ("headers").

A MapJsonSerializer is provided that converts a Map to/from
JSON. Jackson can't delimit multiple objects in a stream
so another serializer is required to encode/decode structure.
A ByteArrayLfSerializer is used by default, inserting a
linefeed between JSON objects.

The combination of these elements now allows header
information to be transferred over TCP. Of course, users
can implment their own (de)serializer to format the
bits on the wire exactly as needed by their application.

INT-1807 Polishing

Add a test that uses a Map MessageConverter with a
Java (de)serializer.

INT-1807: Polishing

INT-1807: Rebased and polished

Change `MapJsonSerializer` to use `JsonObjectMapper` abstraction

Doc Polishing
2013-08-16 16:54:00 -04:00
Gary Russell
1847eaa194 INT-3110 Fix JMX Control Bus With SF 3.2.3
Spring 3.2.3 registers MBean operations with parameter names
instead of the JVM default p1, p2 etc based on parameter position
in the method signature.

Since the OperationInvokingMessageHandler matched the supplied
arguments using the p1, p2 etc names, this prevented the control
bus from finding the target method.

Fall back to the old naming scheme based on parameter position
if a matching parameter is not found.

Add a test using a Map payload to supply the named arguments (p1, p2).

Add an ignored test that tests using named arguments (key, channelName).

Test with 3.1.4; remove Ignore and test with 3.2.3.

TODO: remove the Ignore annotation when SF 3.2.3 is the minimum.
2013-08-16 16:14:29 -04:00
Gary Russell
4832130ef2 INT-3082 (S)FTP Remove Deprecated 'cache-sessions'
The 'cache-sessions' attribute was deprecated in 2.1 in favor
of using a configured CachingConnectionFactory to provide more
flexibility, such as setting the cache size.

Remove the attribute from the schemas.

Update tests.

Add docs.

Update Migration Guide on the project Wiki.
2013-08-16 13:12:46 -04:00