--- url: "http://www.enterpriseintegrationpatterns.com/MessageConstructionIntro.html" titulek: "Introduction to Message Construction - Enterprise Integration Patterns" h1: "" popis: "In Introduction to Messaging Systems, we discussed Message. When two applications wish to exchange a piece of data, they do so by wrapping it in a message. Whereas a Message Channel cannot transmit raw data per se, it can transmit the data wrapped in a message." jazyk: "en" kanonicka: "" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-15 15:33:59" znaku: 6882 slov: 774 kodovani: "utf-8" sha256: "6e406f30907047d22a98c1bf5075272eeeea25db2dd9cd1428b0854c2d71249c" --- | | Introduction to Message Construction[Messaging Patterns](index.html) » [Message Construction](MessageConstructionIntro.html) | [Contents](toc.html)[⇐ Prev](MessageBus.html)[Next ⇒](CommandMessage.html) | | --- | --- | --- | In [*Introduction to Messaging Systems*](MessagingComponentsIntro.html), we discussed [*Message*](Message.html). When two applications wish to exchange a piece of data, they do so by wrapping it in a message. Whereas a [*Message Channel*](MessageChannel.html) cannot transmit raw data per se, it can transmit the data wrapped in a message. Deciding to create a [*Message*](Message.html) and send it raises several other issues: **Message intent** — Messages are ultimately just bundles of data, but the sender can have different intentions for what it expects the receiver to do with the message. It can send a [*Command Message*](CommandMessage.html), specifying a function or method on the receiver that the sender wishes to invoke. The sender is telling the receiver what code to run. It can send a [*Document Message*](DocumentMessage.html), enabling the sender to transmit one of its data structures to the receiver. The sender is passing the data to the receiver, but not specifying what the receiver should necessarily do with it. Or it can send an [*Event Message*](EventMessage.html), notifying the receiver of a change in the sender. The sender is not telling the receiver how to react, just providing notification. **Returning a response** — When an application sends a message, it often expects a response confirming that the message has been processed and providing the result. This is a [*Request-Reply*](RequestReply.html) scenario. The request is usually a [*Command Message*](CommandMessage.html), and the reply is a [*Document Message*](DocumentMessage.html) containing a result value or an exception. The requestor should specify a [*Return Address*](ReturnAddress.html) in the request to tell the replier what channel to use to transmit the reply. The requestor may have multiple requests in process, so the reply should contain a [*Correlation Identifier*](CorrelationIdentifier.html) that specifies which request this reply corresponds to. [[JMS11, pp.27-28](http://java.sun.com/products/jms/docs.html)] There are two common [*Request-Reply*](RequestReply.html) scenarios worth noting that both involve a [*Command Message*](CommandMessage.html) request and a corresponding [*Document Message*](DocumentMessage.html) reply. In the first scenario, *Messaging RPC*, the requestor not only wants to invoke a function on the replier, but also wants the return value from the function. This is how applications perform an RPC (Remote Procedure Call) using [*Messaging*](Messaging.html). In the other scenario, *Messaging Query*, the requestor is performing a query that the replier will execute and return the results in the reply. This is how applications use messaging to perform a query remotely. **Huge amounts of data** — Sometimes applications want to transfer a really large data structure, one that may not fit comfortably in a single message. In this case, break the data into more managable chunks and send them as a [*Message Sequence*](MessageSequence.html). The chunks have to be sent as a sequence, and not just a bunch of messages, so that the receiver can reconstruct the original data structure. **Slow messages** — A concern with messaging is that the sender often does not know how long it will take for the receiver to receive the message. Yet the message contents may be time-sensitive, such that if the message isn’t received by a deadline, it should just be ignored and discarded. In this situation, the sender can use [*Message Expiration*](MessageExpiration.html) to specify an expiration date. If the messaging system cannot deliver a message by its expiration, it should discard the message. If a receiver gets a message after its expiration, it should discard the message. So it’s not enough to decide to use a [*Message*](Message.html); anytime data needs to be transferred, it will be done through a message. This chapter will explain the other decisions that go into making messages work. ## Integration Pattern Language [Message Construct.](MessageConstructionIntro.html) [Message](Message.html) [Command Message](CommandMessage.html) [Document Message](DocumentMessage.html) [Event Message](EventMessage.html) [Request-Reply](RequestReply.html) [Return Address](ReturnAddress.html) [Correlation Identifier](CorrelationIdentifier.html) [Message Sequence](MessageSequence.html) [Message Expiration](MessageExpiration.html) [Format Indicator](FormatIndicator.html) [Message Routing](MessageRoutingIntro.html) [Pipes-and-Filters](PipesAndFilters.html) [Message Router](MessageRouter.html) [Content-based Router](ContentBasedRouter.html) [Message Filter](Filter.html) [Dynamic Router](DynamicRouter.html) [Recipient List](RecipientList.html) [Splitter](Sequencer.html) [Aggregator](Aggregator.html) [Resequencer](Resequencer.html) [Composed Msg. Processor](DistributionAggregate.html) [Scatter-Gather](BroadcastAggregate.html) [Routing Slip](RoutingTable.html) [Process Manager](ProcessManager.html) [Message Broker](MessageBroker.html) [Message Transformation](MessageTransformationIntro.html) [Message Translator](MessageTranslator.html) [Envelope Wrapper](EnvelopeWrapper.html) [Content Enricher](DataEnricher.html) [Content Filter](ContentFilter.html) [Claim Check](StoreInLibrary.html) [Normalizer](Normalizer.html) [Canonical Data Model](CanonicalDataModel.html) [Messaging Endpoints](MessagingEndpointsIntro.html) [Message Endpoint](MessageEndpoint.html) [Messaging Gateway](MessagingGateway.html) [Messaging Mapper](MessagingMapper.html) [Transactional Client](TransactionalClient.html) [Polling Consumer](PollingConsumer.html) [Event-driven Consumer](EventDrivenConsumer.html) [Competing Consumers](CompetingConsumers.html) [Message Dispatcher](MessageDispatcher.html) [Selective Consumer](MessageSelector.html) [Durable Subscriber](DurableSubscription.html) [Idempotent Receiver](IdempotentReceiver.html) [Service Activator](MessagingAdapter.html) [Messaging Channels](MessagingChannelsIntro.html) [Message Channel](MessageChannel.html) [Point-to-Point Channel](PointToPointChannel.html) [Publish-Subscr. Channel](PublishSubscribeChannel.html) [Datatype Channel](DatatypeChannel.html) [Invalid Message Channel](InvalidMessageChannel.html) [Dead Letter Channel](DeadLetterChannel.html) [Guaranteed Delivery](GuaranteedMessaging.html) [Channel Adapter](ChannelAdapter.html) [Messaging Bridge](MessagingBridge.html) [Message Bus](MessageBus.html) [Systems Mgmt.](SystemManagementIntro.html) [Control Bus](ControlBus.html) [Detour](Detour.html) [Wire Tap](WireTap.html) [Message History](MessageHistory.html) [Message Store](MessageStore.html) [Smart Proxy](SmartProxy.html) [Test Message](TestMessage.html) [Channel Purger](ChannelPurger.html)