/** * Returns a builder object that offers a step-by-step fluent API to build * a custom JMS {@link StreamSource} for the Pipeline API. See javadoc on * {@link JmsSourceBuilder} methods for more details. * <p> * This source uses the {@link Message#getJMSTimestamp() JMS' message * timestamp} as the native timestamp, if {@linkplain * StreamSourceStage#withNativeTimestamps(long) enabled}. * <p> * The source does not save any state to snapshot. The source starts * emitting items where it left from. * <p> * IO failures should be handled by the JMS provider. If any JMS operation * throws an exception, the job will fail. Most of the providers offer a * configuration parameter to enable auto-reconnection, refer to provider * documentation for details. * <p> * Default local parallelism for this processor is 4 (or less if less CPUs * are available). */ @Nonnull public static JmsSourceBuilder jmsQueueBuilder(DistributedSupplier<? extends ConnectionFactory> factorySupplier) { return new JmsSourceBuilder(factorySupplier, false); }
/** * Convenience for {@link JmsSourceBuilder#build(DistributedFunction)}. */ public StreamSource<Message> build() { return build(message -> message); }
/** * Convenience for {@link #jmsTopicBuilder(DistributedSupplier)}. This * version creates a connection without any authentication parameters and * uses non-transacted sessions with {@code Session.AUTO_ACKNOWLEDGE} mode. * JMS {@link Message} objects are emitted to downstream. * <p> * <b>Note:</b> {@link javax.jms.Message} might not be serializable. In * that case you can use {@linkplain #jmsTopicBuilder(DistributedSupplier) * the builder} and add a projection. * * @param factorySupplier supplier to obtain JMS connection factory * @param name the name of the topic */ @Nonnull public static StreamSource<Message> jmsTopic( @Nonnull DistributedSupplier<? extends ConnectionFactory> factorySupplier, @Nonnull String name ) { return jmsTopicBuilder(factorySupplier) .destinationName(name) .build(); }
isTopic ? streamJmsTopicP(connectionSupplier, sessionFn, consumerFn, flushFn, projectionFn, policy) : streamJmsQueueP(connectionSupplier, sessionFn, consumerFn, flushFn, projectionFn, policy); return Sources.streamFromProcessorWithWatermarks(sourceName(), metaSupplierFactory, true);
/** * Convenience for {@link #jmsQueueBuilder(DistributedSupplier)}. This * version creates a connection without any authentication parameters and * uses non-transacted sessions with {@code Session.AUTO_ACKNOWLEDGE} mode. * JMS {@link Message} objects are emitted to downstream. * <p> * <b>Note:</b> {@link javax.jms.Message} might not be serializable. In * that case you can use {@linkplain #jmsQueueBuilder(DistributedSupplier) * the builder} and add a projection. * * @param factorySupplier supplier to obtain JMS connection factory * @param name the name of the queue */ @Nonnull public static StreamSource<Message> jmsQueue( @Nonnull DistributedSupplier<? extends ConnectionFactory> factorySupplier, @Nonnull String name ) { return jmsQueueBuilder(factorySupplier) .destinationName(name) .build(); }
return new JmsSourceBuilder(factorySupplier, true);