Anfang des Inhaltsbereichs

Diese Grafik wird im zugehörigen Text erklärt Unpacking the Received Messages Dokument im Navigationsbaum lokalisieren

Diese Grafik wird im zugehörigen Text erklärt

When a new message is received, you have to unpack it first. The procedure is the same for both the point-to-point and publish-subscribe messages types, but depends on the type of message you receive.

Unpacking Bytes Message

Syntax

// create a byte array with the received data

byte [] receivedBytes;

// create an integer object to receive the data with that specified length:

int dataLength;

// get the data from the Bytes Message:

dataLength = bytesMessage.readBytes(receivedBytes);

Unpacking Map Message

The data received by the map message can be read in any order.

Syntax

String stringData;

long longData;

stringData = mapMessage.getString(“message”);

longData = mapMessage.getLong(“long”);

Unpacking Object Message

To unpack an object message, you must make methods in the Serializable class that can transmit this data to your message. Then you have to create objects to take the data from this object:

Syntax

String stringValue;

long longValue;

Class_Implementing_Serialaizable cis = new Class_Implementing_Serialaizable();

cis =  objectMessage.getObject();

stringValue = cis.getString();

longValue = cis.getLong();

Unpacking Stream Message

To unpack the stream message you have to get its data in the order it was sent.

Syntax

String stringValue;

long longValue;

stringValue = streamMessage.readString();

longValue = streamMessage.readLong();

Unpacking Text Message

Syntax

String text;

text = textMessage.getText();

 

 

Ende des Inhaltsbereichs