Refactored existing Message-consuming endpoints to only implement MessageConsumer (not MessageEndpoint). Now, either a PollingConsumerEndpoint or SubscribingConsumerEndpoint delegates to the MessageConsumer thereby separating the Lifecycle responsibilities and configuration settings (trigger, transactions, etc) since they are different for polling vs. subscribing and not relevant for simply consuming Messages. Essentially all MessageConsumers are now "event-driven" since a "polling consumer" is actually handled by the PollingConsumerEndpoint class. The next refactoring step involves renaming several components to clarify this endpoint vs. consumer distinction.
This commit is contained in:
@@ -29,7 +29,7 @@ import org.springframework.integration.httpinvoker.HttpInvokerOutboundGateway;
|
||||
public class HttpInvokerOutboundGatewayParser extends AbstractRemotingOutboundGatewayParser {
|
||||
|
||||
@Override
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
protected Class<?> getGatewayClass(Element element) {
|
||||
return HttpInvokerOutboundGateway.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,10 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.endpoint.SubscribingConsumerEndpoint;
|
||||
import org.springframework.integration.httpinvoker.HttpInvokerOutboundGateway;
|
||||
|
||||
/**
|
||||
@@ -33,7 +35,9 @@ public class HttpInvokerOutboundGatewayParserTests {
|
||||
public void testHttpInvokerOutboundGatewayParser() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"httpInvokerOutboundGatewayParserTests.xml", this.getClass());
|
||||
Object gateway = context.getBean("gateway");
|
||||
Object endpoint = context.getBean("gateway");
|
||||
assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass());
|
||||
Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer");
|
||||
assertEquals(HttpInvokerOutboundGateway.class, gateway.getClass());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user