Class JmsIO.Read<T>

    • Field Summary

      • Fields inherited from class org.apache.beam.sdk.transforms.PTransform

        annotations, displayData, name, resourceHints
    • Constructor Summary

      Constructors 
      Constructor Description
      Read()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.beam.sdk.values.PCollection<T> expand​(org.apache.beam.sdk.values.PBegin input)  
      void populateDisplayData​(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder)  
      JmsIO.Read<T> withAutoScaler​(AutoScaler autoScaler)
      Sets the AutoScaler to use for reporting backlog during the execution of this source.
      JmsIO.Read<T> withCloseTimeout​(org.joda.time.Duration closeTimeout)
      Sets the amount of time to wait for callbacks from the runner stating that the output has been durably persisted before closing the connection to the JMS broker.
      JmsIO.Read<T> withCoder​(org.apache.beam.sdk.coders.Coder<T> coder)  
      JmsIO.Read<T> withConnectionFactory​(javax.jms.ConnectionFactory connectionFactory)
      Specify the JMS connection factory to connect to the JMS broker.
      JmsIO.Read<T> withConnectionFactoryProviderFn​(org.apache.beam.sdk.transforms.SerializableFunction<java.lang.Void,​? extends javax.jms.ConnectionFactory> connectionFactoryProviderFn)
      Specify a JMS connection factory provider function to connect to the JMS broker.
      JmsIO.Read<T> withMaxNumRecords​(long maxNumRecords)
      Define the max number of records that the source will read.
      JmsIO.Read<T> withMaxReadTime​(org.joda.time.Duration maxReadTime)
      Define the max read time that the source will read.
      JmsIO.Read<T> withMessageMapper​(JmsIO.MessageMapper<T> messageMapper)  
      JmsIO.Read<T> withPassword​(java.lang.String password)
      Define the password to connect to the JMS broker (authenticated).
      JmsIO.Read<T> withQueue​(java.lang.String queue)
      Specify the JMS queue destination name where to read messages from.
      JmsIO.Read<T> withReceiveTimeout​(org.joda.time.Duration receiveTimeout)
      If set, block for the Duration of timeout for each poll to new JMS record if the previous poll returns no new record.
      JmsIO.Read<T> withRequiresDeduping()
      If set, requires runner deduplication for the messages.
      JmsIO.Read<T> withTopic​(java.lang.String topic)
      Specify the JMS topic destination name where to receive messages from.
      JmsIO.Read<T> withUsername​(java.lang.String username)
      Define the username to connect to the JMS broker (authenticated).
      • Methods inherited from class org.apache.beam.sdk.transforms.PTransform

        addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, setDisplayData, setResourceHints, toString, validate, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Read

        public Read()
    • Method Detail

      • withConnectionFactoryProviderFn

        public JmsIO.Read<T> withConnectionFactoryProviderFn​(org.apache.beam.sdk.transforms.SerializableFunction<java.lang.Void,​? extends javax.jms.ConnectionFactory> connectionFactoryProviderFn)
        Specify a JMS connection factory provider function to connect to the JMS broker. Use this method in case your ConnectionFactory objects are themselves not serializable, but you can recreate them as needed with a SerializableFunction provider

        For instance:

         pipeline.apply(JmsIO.read().withConnectionFactoryProviderFn(() -> new MyJmsConnectionFactory());
         
        Specified by:
        withConnectionFactoryProviderFn in interface JmsIO.ConnectionFactoryContainer<T>
        Parameters:
        connectionFactoryProviderFn - a SerializableFunction that creates a ConnectionFactory
        Returns:
        The corresponding JmsIO.Read
      • withQueue

        public JmsIO.Read<T> withQueue​(java.lang.String queue)
        Specify the JMS queue destination name where to read messages from. The JmsIO.Read acts as a consumer on the queue.

        This method is exclusive with withTopic(String). The user has to specify a destination: queue or topic.

        For instance:

        
         pipeline.apply(JmsIO.read().withQueue("my-queue")
        
         
        Parameters:
        queue - The JMS queue name where to read messages from.
        Returns:
        The corresponding JmsIO.Read.
      • withTopic

        public JmsIO.Read<T> withTopic​(java.lang.String topic)
        Specify the JMS topic destination name where to receive messages from. The JmsIO.Read acts as a subscriber on the topic.

        This method is exclusive with withQueue(String). The user has to specify a destination: queue or topic.

        For instance:

        
         pipeline.apply(JmsIO.read().withTopic("my-topic")
        
         
        Parameters:
        topic - The JMS topic name.
        Returns:
        The corresponding JmsIO.Read.
      • withUsername

        public JmsIO.Read<T> withUsername​(java.lang.String username)
        Define the username to connect to the JMS broker (authenticated).
      • withPassword

        public JmsIO.Read<T> withPassword​(java.lang.String password)
        Define the password to connect to the JMS broker (authenticated).
      • withMaxNumRecords

        public JmsIO.Read<T> withMaxNumRecords​(long maxNumRecords)
        Define the max number of records that the source will read. Using a max number of records different from Long.MAX_VALUE means the source will be Bounded, and will stop once the max number of records read is reached.

        For instance:

        
         pipeline.apply(JmsIO.read().withNumRecords(1000)
        
         
        Parameters:
        maxNumRecords - The max number of records to read from the JMS destination.
        Returns:
        The corresponding JmsIO.Read.
      • withMaxReadTime

        public JmsIO.Read<T> withMaxReadTime​(org.joda.time.Duration maxReadTime)
        Define the max read time that the source will read. Using a non null max read time duration means the source will be Bounded, and will stop once the max read time is reached.

        For instance:

        
         pipeline.apply(JmsIO.read().withMaxReadTime(Duration.minutes(10))
        
         
        Parameters:
        maxReadTime - The max read time duration.
        Returns:
        The corresponding JmsIO.Read.
      • withCoder

        public JmsIO.Read<T> withCoder​(org.apache.beam.sdk.coders.Coder<T> coder)
      • withAutoScaler

        public JmsIO.Read<T> withAutoScaler​(AutoScaler autoScaler)
        Sets the AutoScaler to use for reporting backlog during the execution of this source.
      • withCloseTimeout

        public JmsIO.Read<T> withCloseTimeout​(org.joda.time.Duration closeTimeout)
        Sets the amount of time to wait for callbacks from the runner stating that the output has been durably persisted before closing the connection to the JMS broker. Any callbacks that do not occur will cause unacknowledged messages to be returned to the JMS broker and redelivered to other clients.
      • withReceiveTimeout

        public JmsIO.Read<T> withReceiveTimeout​(org.joda.time.Duration receiveTimeout)
        If set, block for the Duration of timeout for each poll to new JMS record if the previous poll returns no new record.

        Use this option if the requirement for read latency is not a concern or excess client polling has resulted network issues.

      • withRequiresDeduping

        public JmsIO.Read<T> withRequiresDeduping()
        If set, requires runner deduplication for the messages. Each message is identified by its JMSMessageID.
      • expand

        public org.apache.beam.sdk.values.PCollection<T> expand​(org.apache.beam.sdk.values.PBegin input)
        Specified by:
        expand in class org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PBegin,​org.apache.beam.sdk.values.PCollection<T>>
      • populateDisplayData

        public void populateDisplayData​(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder)
        Specified by:
        populateDisplayData in interface org.apache.beam.sdk.transforms.display.HasDisplayData
        Overrides:
        populateDisplayData in class org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PBegin,​org.apache.beam.sdk.values.PCollection<T>>