Question

I've been reading up on Spring Integration and Enterprise Integration Patterns.

I'm stuck on the Messaging Bridge pattern: http://enterpriseintegrationpatterns.com/MessagingBridge.html http://static.springsource.org/spring-integration/docs/2.0.0.M3/spring-integration-reference/html/bridge.html

What's the difference between a messaging bridge and a message translator in terms of message processing? Don't they both make it possible for two entities requiring disparate formats to work together?

Was it helpful?

Solution

From a pure EIP perspective, the translator is used to transform a message within a system whereas a bridge might include transformation between different systems.

In Spring Integration the <bridge/> implementation is simply used as a no-op component between channels.

For example, you might have a common sub-flow that starts with a channel - let's say just some small number of components culminating in an outbound adapter (e.g. FTP). You might want to re-use that sub-flow in multiple applications - you could package it up in a jar and document that it starts with, say toFTPChannel. Now, other applications that might want to use this "component" can simply <bridge/> their output channels to toFTPChannel.

The bridge does nothing more than allow you to connect two channels to one another.

Another use case is in Unit/Intgration testing - for example you might bridge the final channel of an application to a QueueChannel so the test can consume the output message and verify it's contents.

OTHER TIPS

Messaging Bridge is to link two different kinds of messaging systems. Ex. The the dominant messaging system of your organization is Tibco EMS that most your applications use to communicate. But now many of your applications also need a special message feed that is only available from an IBM-MQ. It would make sense, then, to bridge/replicate the MQ feed to an EMS topic, so that your applications that are used to talk to EMS can now easily consume messages from the bridged EMS topic rather than the MQ.

Message Translator is mostly a data format mapper within the same messaging system. It focuses on switching data formats (ex. from XML to JSon) as opposed to messaging transports (ex. from MQ to EMS).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top