Tutorial

  1. Home
  2. Docs
  3. Tutorial
  4. 22. What is message type?
  5. 22.1 How to use message type?

22.1 How to use message type?

Message Type:

In Applications that use Service Broker communicate by sending messages to each other as part of a conversation. The participants in a conversation must agree on the name and content of each message. A message type object defines a name for a message type and defines the type of data that the message contains. Message types persist in the database where the message type is created. You create an identical message type in each database that participates in a conversation.

Each message type specifies the validation that SQL Server performs for messages of that type. SQL Server can validate that the message contains valid XML, that the message contains XML that conforms to a particular schema, or that the message contains no data at all. For arbitrary or binary data, the message type can specify that SQL Server does not validate the content of the message.

Validation is performed when the destination service receives the message. If the content of the message does not match the validation specified, Service Broker returns an error message to the service that sent the message.

1.  Use Message type to model interface data structure

Let us introduce a  concept “Message type“ Spring 18 .Until today user create field and data structure for  interface manually as Istructure inside the interface. Other possibility is to upload from a csv or xml file to create the interface data structure. This concept is not global enough and thus not reusable.

With message type user can create message type for example by importing a WSDL from an external system. User can create message type which link to other message type to create a hierarchy of message type. After user created the message type simply use it as interface data type. The advantage using message type is that you can reuse that message type again and again for other interface. With the old concept you can only create structure which bound only to a local interface.

Message type need to be store in a catalogue. Such a catalogue is the repository concept. A repository contain different message type like a library contain different functions. In other to logically group similar repository from a system let says Google, Amazon or SAP we provide the concept of the Meta Data Provider. The Meta Data Provider denote a system or a vendor. For example you want to create messages type to connect to SAP. So user need first to create the Meta data provider with the name “SAP”. Now you can create different repository below this name. This is like building a logical category.

1.1    Manually created message type

We can create Istructure in Istructure Repository. In this case user  can create fields by themselves

In this example user created  Istructure fields to use for the “Account“ in which Istructure Repository name is  „Test Message“.

After creating the Istructure user can assign them to a message type. We create two message types in the repository with the name “Test Message 1″ and „Test message 2“  in this example.  User can create number of message types within a repository.

This message is used in the interface as interface type.

Was this article helpful to you? Yes No

How can we help?