Examples
Examples of GET map function
In the following example, assume that the adapter being used in a GET function is defined as follows:
This will pick the first message in the queue and transform according to the adapter mentioned in the output card.
GET("ACTIVEMQ", "-URL tcp://localhost:61616 -Q TEST_QUEUE -DT 5 -TV C:\temp\m4activemq.log")
Now, assume the GET map function was defined as follows (the specified queue name is not present):
GET("ACTIVEMQ", -URL tcp://localhost:61616 -Q MISSING_QUEUE -DT 5 -TV C:\temp\m4activemq.log)
In this case, the adapter throws error: Queue MISSING_QUEUE doesn't exist, as it cannot find the queue name specified.
Examples of PUT map function
In the following example, assume that the adapter being used in a PUT function is defined as follows:
If the queue is not present, it will create the queue and put the message; if the queue is present, it will simply put the message into the queue TEST_QUEUE. Here, the message type is byte.
PUT("ACTIVEMQ", "-URL tcp://localhost:61616 -Q TEST_QUEUE -CQ -MT byte -TV C:\temp\m4activemq.log", in_data_type)
Now, assume that the message type is not mentioned.
PUT("ACTIVEMQ", "-URL tcp://localhost:61616 -Q TEST_QUEUE -CQ -TV C:\temp\m4activemq.log", in_data_type)
In this case, it will throw the following error: Message type must be blob/byte/Text.
Now, assume that the adapter is used in a PUT function, but the queue name mentioned is not present.
PUT("ACTIVEMQ", "-URL tcp://localhost:61616 -Q TEST_QUEUE -MT byte -TV C:\temp\m4activemq.log", in_data_type)
It will throw the following error message: Queue TEST_QUEUE does not exist. By default, the create queue flag is false. It needs to be set to true explicitly, if the queue is not present and the user wants to create the queue.