INT-3425: Deprecate TCP Event Channel Adapter

JIRA: https://jira.spring.io/browse/INT-3425

Deprecate `TcpConnectionEventListeningMessageProducer` in favor
of using a generic event inbound channel adapter.

Polishing
This commit is contained in:
Gary Russell
2015-07-13 18:40:16 -04:00
committed by Artem Bilan
parent 583d432f22
commit f1fc0edbf3
11 changed files with 45 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHa
*/
public class IpNamespaceHandler extends AbstractIntegrationNamespaceHandler {
@SuppressWarnings("deprecation")
public void init() {
this.registerBeanDefinitionParser("udp-inbound-channel-adapter", new UdpInboundChannelAdapterParser());
this.registerBeanDefinitionParser("udp-outbound-channel-adapter", new UdpOutboundChannelAdapterParser());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,10 @@ import org.springframework.integration.ip.tcp.connection.TcpConnectionEventListe
/**
* @author Gary Russell
* @since 3.0
*
* @deprecated in favor of the generic event adapter.
*/
@Deprecated
public class TcpConnectionEventInboundChannelAdapterParser extends AbstractChannelAdapterParser {
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,12 @@ import org.springframework.util.CollectionUtils;
* @author Gary Russell
* @since 3.0
*
* @deprecated in favor of using the generic {@code ApplicationEventListeningMessageProducer} which
* can now more efficiently filter required events. Configure the adapter to handle
* {@link TcpConnectionEvent}.
*
*/
@Deprecated
public class TcpConnectionEventListeningMessageProducer extends MessageProducerSupport
implements ApplicationListener<TcpConnectionEvent> {

View File

@@ -410,7 +410,7 @@
<xsd:attribute name="remote-timeout-expression" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Specifies an expresssion that is evaluated against the outbound message
Specifies an expresssion that is evaluated against the outbound message
to determine the time the gateway will wait for a reply
from the remote system. Mutually exclusive with
'remote-timeout'.
@@ -701,6 +701,7 @@
<xsd:element name="tcp-connection-event-inbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
[DEPRECATED: Use an event inbound channel adapter instead]
Configures an inbound Channel Adapter which
listens for TCP Connection
events, converts them to Messages and

View File

@@ -55,7 +55,6 @@ import org.springframework.integration.ip.tcp.connection.DefaultTcpNetSSLSocketF
import org.springframework.integration.ip.tcp.connection.DefaultTcpNioSSLConnectionSupport;
import org.springframework.integration.ip.tcp.connection.DefaultTcpSSLContextSupport;
import org.springframework.integration.ip.tcp.connection.TcpConnectionEvent;
import org.springframework.integration.ip.tcp.connection.TcpConnectionEventListeningMessageProducer;
import org.springframework.integration.ip.tcp.connection.TcpConnectionOpenEvent;
import org.springframework.integration.ip.tcp.connection.TcpConnectionSupport;
import org.springframework.integration.ip.tcp.connection.TcpMessageMapper;
@@ -268,8 +267,9 @@ public class ParserUnitTests {
@Autowired
TcpMessageMapper mapper;
@SuppressWarnings("deprecation")
@Autowired
TcpConnectionEventListeningMessageProducer eventAdapter;
org.springframework.integration.ip.tcp.connection.TcpConnectionEventListeningMessageProducer eventAdapter;
@Autowired
QueueChannel eventChannel;
@@ -664,7 +664,7 @@ public class ParserUnitTests {
assertSame(socketSupport, dfa.getPropertyValue("tcpSocketSupport"));
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "deprecation" })
@Test
public void testEventAdapter() {
Set<?> eventTypes = TestUtils.getPropertyValue(this.eventAdapter, "eventTypes", Set.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@ import org.springframework.messaging.Message;
*/
public class TcpConnectionEventListenerTests {
@SuppressWarnings("deprecation")
@Test
public void testNoFilter() {
TcpConnectionEventListeningMessageProducer eventProducer = new TcpConnectionEventListeningMessageProducer();
@@ -62,7 +63,7 @@ public class TcpConnectionEventListenerTests {
assertNull(message);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "deprecation" })
@Test
public void testFilter() {
TcpConnectionEventListeningMessageProducer eventProducer = new TcpConnectionEventListeningMessageProducer();