![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |
This section discusses sending data using the SDK send() method. For simplicity, the discussion uses a publisher as an example. The same concepts apply if data is sent as part of a client/server interaction.An SDK MPublisher has various send() methods that take an MInstance (or other composite MData subclass) as an argument. Because the publisher has been created to use one of the supported message formats, you can pass in the MInstance and the publisher handles the serialization appropriately.Custom adapters can also send an MTree. In that case, the custom adapter must explicitly serialize the MInstance.It is recommended that you use the MPublisher.send() method to send an MInstance and let the SDK perform serialization.If you explicitly serialize the MInstance, the serialization method must know which message format to use. Choose one of the following options:
• Set a global variable (MESSAGEFORMAT) to determine the message format. This variable is then used by the SDK each time the MTree is serialized. Set the global variable as follows:MAppProperties.set(MESSAGEFORMAT, ...)
• Pass the message format as an argument, so the SDK can use the correct format for serialization. Here is a sample code fragment:
• Accept the default, aeRvMsg.
If an MTree is produced with a message format that does not match the sending endpoint, the endpoint is forced to convert the MTree to the matching message format. The performance cost of doing so is often unacceptable for production systems.
![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |