Package org.apache.beam.sdk.io.jms
Class JmsIO
- java.lang.Object
-
- org.apache.beam.sdk.io.jms.JmsIO
-
public class JmsIO extends java.lang.ObjectAn unbounded source for JMS destinations (queues or topics).Reading from a JMS destination
JmsIO source returns unbounded collection of JMS records as
PCollection<JmsRecord>. AJmsRecordincludes JMS headers and properties, along with the JMSTextMessagepayload.To configure a JMS source, you have to provide a
ConnectionFactoryand the destination (queue or topic) where to consume. The following example illustrates various options for configuring the source:pipeline.apply(JmsIO.read() .withConnectionFactory(myConnectionFactory) .withQueue("my-queue") // above two are required configuration, returns PCollection<JmsRecord> // rest of the settings are optionalIt is possible to read any type of JMS
Messageinto a custom POJO using the following configuration:pipeline.apply(JmsIO.<T>readMessage() .withConnectionFactory(myConnectionFactory) .withQueue("my-queue") .withMessageMapper((MessageMapper<T>) message -> { // code that maps message to T }) .withCoder( // a coder for T )Writing to a JMS destination
JmsIO sink supports writing text messages to a JMS destination on a broker. To configure a JMS sink, you must specify a
ConnectionFactoryand aDestinationname. For instance:pipeline .apply(...) // returns PCollection<String> .apply(JmsIO.write() .withConnectionFactory(myConnectionFactory) .withQueue("my-queue")
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceJmsIO.ConnectionFactoryContainer<T extends JmsIO.ConnectionFactoryContainer<T>>static interfaceJmsIO.MessageMapper<T>An interface used byJmsIO.Readfor converting each jmsMessageinto an element of the resultingPCollection.static classJmsIO.Read<T>APTransformto read from a JMS destination.static classJmsIO.Write<EventT>APTransformto write to a JMS queue.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JmsIO.Read<JmsRecord>read()static <T> JmsIO.Read<T>readMessage()static <EventT> JmsIO.Write<EventT>write()
-
-
-
Method Detail
-
read
public static JmsIO.Read<JmsRecord> read()
-
readMessage
public static <T> JmsIO.Read<T> readMessage()
-
write
public static <EventT> JmsIO.Write<EventT> write()
-
-