question

Upvotes
Accepted
5 0 0 3

Encoding the payload

I didn't get required information regarding OMMEncoder in the RFAJ devleopers guide . Please provide answers to some of my questions
1. what are the advantages of using OMMEncoder?
2. is it optional or mandatory to encode payload, attrib element etc.
3. What happens , if i dont encode the payload in the batch/view request?
4. what happens, if i encode the payload in the batch/view request?

treprfarfa-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
1.9k 6 9 16
@Haribabu_annem
1. what are the advantages of using OMMEncoder?

If you want to send a message that contains information other than a message header such as a msgKey's attribinfo or a payload, OMMEncoder is the only class that allows you to encode that information into OMMMsg object.


2. is it optional or mandatory to encode payload, attrib element etc.

Yes, it is mandatory as describe above.


3. What happens , if i dont encode the payload in the batch/view request?
4. what happens, if i encode the payload in the batch/view request?

It depends on the indication flag in the message header. If the application sets BATCH_REQ in the indication flags header, but it doesn't encode elementList of ':ItemList' in the payload part, the application will throw a "java.lang.IllegalArgumentException: Batch Request has no valid item names in the request" error message when registerClient() method is called.

In other hand, if the application doesn't set BATCH_REQUEST, but it encodes the itemName in the payload, the application will also encounter another error message (java.lang.IllegalArgumentException: OMMConsumer does not support request message with messageType OMMMsg.MsgType.REQUEST and payload OMMTypes.ELEMENT_LIST) because RFA underlying layer will expect that a request message must contain itemName in the msgKey part, and payload contains nothing (if it doesn't send view).

In summary, it depends on the flag. The application should encode a message format and content as specified in flags accordingly.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea