If you are using INotificationService portal service, then this blog is relevant for you.
The basics that describe how to use this portal service to transfer notifications in the portal to the different server nodes of a cluster are documented in the following blog: How to use the INotificationService API in SAP Portal 7.30
This blog extends the knowledge of the previous blog by describing the different types of data that can be used.
The data that is being transferred via the INotificationService is wrapped within a TopicDataContainer object. To the container you should add TopicData objects, recognized by their IDs:
TopicDataContainer container = new TopicDataContainer("TopicContainerName1");
This example adds new TopicData with value "Topic2Str", and with ID "Topic2Id" to the TopicDataContainer "TopicContainerName1".
This example uses the default TopicType – TopicDataContainer.STRING.
This type can be used as long as the string does not contain special characters, such as ‘\n’ and ‘\r’. If your data contains such characters, you will get NULL TopicData on the receiver side (in the handleTopic() method) .
So what should be used when transferring special characters, or other data types?
Well, there are few other supported data types:
In order to use the first two, you should create special TopicData objects respectively:
(clicking on the links redirects to the formal SAP documentation):
// Type TopicDataContainer.STREAM
ByteArrayInputStream bais = new ByteArrayInputStream("This is my text.\n it contains special characters\r.".getBytes());
StreamData streamData = new StreamData(bais);
// Type TopicDataContainer.FILE
FileData fileData = new FileData(directoryPath);
// Type TopicDataContainer.INT
container.addTopicData("TopicIntID", new TopicData(TopicDataContainer.INT, "13"));
In general you should always consider whether the data is really necessary to be transferred, as using the STRING type or INT type are considered to be faster, and performance is an important aspect during portal runtime .