JIRA: https://jira.spring.io/browse/INT-3886
An SO user reported a short message delivery when an NIO connection was timed out.
See JIRA for link.
We could not produce the problem with his deserializer but it did identify a problem
with the standard `ByteArrayRawSerializer`.
With NIO, socket timeouts were reported to the deserializer as a normal EOF (-1). This
caused the raw serializer to emit a short message - it's signal for end of message is the
socket closure.
We can't treat a timeout as a normal EOF.
If the socket is forcibly timed out due to no recent data, throw a `SocketTimeoutException` to
the deserializer.
Just in case the old behavior is being relied upon, a boolean has been added to restore that
behavior. This is not recommended, as using timeout to delimit messages is not reliable.
* Fix typos
* Increase `MongoDbInboundChannelAdapterIntegrationTests` timeouts
* Some code polishing
Message producers are started in phase `Integer.MAX_INT / 2`.
The test case has a stomp inbound adapter and an event producer.
Since they are both in the same phase, the event producer can miss the `StompReceiptEvent`.
Change the phase of the event producer to ensure it is started before other message producers.
Examining the code revealed a possible (but improbable) NPE.
Checking the connection was disjoint from the publish; encapsulate the check within publish.
Synchronize the connectionLost method so it can't null the client while it is being checked.
Add `@SuppressWarnings("deprecation")` on the deprecated `connectIfNeeded()` usage.
Leadership was yielded before testing whether the adapter was started when leadership was granted.
It was possible for the adapter to be stopped again before testing `isRunning()`.
JIRA: https://jira.spring.io/browse/INT-3874
Previously the `IntegrationEvaluationContextFactoryBean` copied only those spel-functions which are defined
as beans in the ctx. Those which are specified through the `setFunctions` hasn't been copied from parent ctx to child.
This fix addresses and issue.
JIRA: https://jira.spring.io/browse/INT-3873
Phase I: add `Log4jLevelAdjuster` to the `StompInboundChannelAdapterWebSocketIntegrationTests` to have more info on the next CI failure.
https://build.spring.io/browse/INT-MJATS41-434
BindException.
Avoid using `findAvailableServerSocket()` where easily possible.
Some still remain, but they would require major rework of the tests.
Also fix a race in `TcpOutboundGatewayTests.testGoodNetGWTimeoutGuts()`. Although an
`AtomicBoolean` was used, both threads might still see the lower (500ms) timeout.
Polishing
JIRA: https://jira.spring.io/browse/INT-3831
- Add `@IntegrationManagedResource`
- Suppress exporting as an endpoint
Fix `outputChannel` issue for anonymous `MessagingGatewaySupport`
INT-3831: Pure JavaConfig Test
INT-3831: Polishing
Check output channel name for anonymous message source metrics.
Don't use getter on MGS to avoid early channel resolution.
INT-3831: Fix Test - Avoid Second MBeanServer
Reference the `MBSFB` in the context rather than create a new `MBeanServer`.
Polishing
JIRA: https://jira.spring.io/browse/INT-3859
The Java Mail `MessageCache.getMessageBySeqnum()` has the code:
````java
if (msgnum < 0) { // XXX - < 1 ?
if (logger.isLoggable(Level.FINE))
logger.fine("no message seqnum " + seqnum);
return null;
}
````
about which the `IMAPFolder.search` doesn't care:
````java
matchMsgs[i] = getMessageBySeqNumber(matches[i]);
````
therefore pops `null`s to the top for the `ImapMailReceiver`
* Fix `NPE` filtering the `Message[]` from `null` items
Note: its enough difficult to reproduce it because it isn't clear how we can end up with:
````java
if (seqnums[msgnum-1] > seqnum)
break; // message doesn't exist
````
in the `MessageCache`.
That's why there is no test-cases on the matter.
**Cherry-pick to 4.1.x**
Polishing
- Only create a new array if needed.
- Add a test case
* `JmsOutboundGatewayTests`: just increase timeouts. Looks like embedded ActiveMQ Broker takes more time to interact on high-loaded builds
* `TcpOutboundGatewayTests`: Rework the race condition fix to the atomic `remoteTimeout` change using mocks
* Modify `ControlBusTests.testControlHeaderChannelReaper()` do not rely on the `timeout`.
Make artificial expiration for the entry in the `registry` to allow `reaper` to remove it according the test logic.
* Fix race condition around `gateway.setRemoteTimeout(5000);` in the `TcpOutboundGatewayTests`.
The problem was that the gateway is called concurrently and `setRemoteTimeout` might be changed before the `handleMessage()` even for the first attempt.
The `ExtractRequestReplyPayloadTests` uses `3000` for `reply-timeout`.
This value might not be enough on high-loaded environment such a CI Server:
https://build.spring.io/browse/INT-B41-450
* Increase the timeouts for adapters to the `10000` to have more chances to pass on the CI.
* Some simple code polishing for the `ExtractRequestReplyPayloadTests`
JIRA: https://jira.spring.io/browse/INT-3860
Similar to INT-3794, if some other process is bound to all adapters
$ lsof -i tcp -nP | grep 9000
java 6604 grussell 380u IPv6 0x407e749ec47fa337 0t0 TCP *:9000 (LISTEN)
The socket utils reports that the localhost is available for binding; however, the test then
binds to all adapters.
1. Where (easily) possible, change tests to use port=0 and let the OS choose.
2. For other tests, use high-numbered ports.
3. Change tests to explicitly bind to localhost (like the utility did).
4. Fix `tcpOutboundGatewayInsideChain` test to use the correct port.
Polishing - Fix Travis
Bind SOLingerTests to localhost.
Since we're using port 0, we have to wait until listening before calling getPort().
JIRA: https://jira.spring.io/browse/INT-3857
Setter injection avoids early instantiation of FB properties.
Enhance aggregator parser tests to include several new properties to
check coverage in FB.
Clean up other tests.
Polishing - PR Comments
JIRA: https://jira.spring.io/browse/INT-3853
Previously the placeholder definitions for the Messaging Annotation weren't be resolved
if we use `<context:property-placeholder>` instead of `@PropertySource`.
Fix `MessagingAnnotationPostProcessor` and its "kindergarten" to use
`beanFactory.resolveEmbeddedValue()` instead of `environment.resolvePlaceholders()`.
JIRA: https://jira.spring.io/browse/INT-3852
Custom object names in `@IntegrationManagedResource` were ignored.
Some EIP objects were wrapped with their `Lifecycle` in order to expose
a single MBean with all attributes and operations.
This process "hid" the annotation so the object namer failed to detect the
presence of a custom object name or the other attributes.
Also, update the `@IntegrationManagedResource` to use the Spring 4.2 `@AliasFor` annotation.
INT-3852: Polishing
Polishing - Test with Proxy
JIRA: https://jira.spring.io/browse/INT-2541
The `IntegrationMBeanExporter` doesn't register any `@ManagedResource` automatically.
Its `autoDetection` is disabled by default.
Hence such a components like `AbstractMessageGroupStore`
or `WireTap` aren't exposed to the JMX by the `IntegrationMBeanExporter`.
From other side `MBeanExporterHelper` aims to help to avoid duplicate exposing if
an `MBeanExporter` is presented in the CTX.
But `MBeanExporterHelper` did that unconditionally just for the whole `org.springframework.integration` package.
Therefore components which aren't EIP ones aren't exposed to the JMX at all.
* Fix `MBeanExporterHelper` to deal for exclusion based on the `@IntegrationManagedResource` annotation.
* Remove `@IntegrationManagedResource` from those components which aren't EIP.
* Make some polishing in the JMX tests.
JIRA: https://jira.spring.io/browse/INT-3849
A file inbound adapter with just a `filter` attribute (no implied filter attributes)
did not get its filter injected.
The parser took an early exit from the filter configuration if none of the implied
filter attributes were specified.
Work around is to explicitly set `ignore-hidden="true"`.