Class JdbcQueue<T>

java.lang.Object
io.kestra.jdbc.runner.JdbcQueue<T>
All Implemented Interfaces:
io.kestra.core.queues.QueueInterface<T>, Closeable, AutoCloseable

public abstract class JdbcQueue<T> extends Object implements io.kestra.core.queues.QueueInterface<T>
  • Field Details

    • mapper

      protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
    • queueService

      protected final io.kestra.core.queues.QueueService queueService
    • cls

      protected final Class<T> cls
    • dslContextWrapper

      protected final JooqDSLContextWrapper dslContextWrapper
    • dataSource

      protected final DataSource dataSource
    • configuration

      protected final JdbcQueue.Configuration configuration
    • table

      protected final org.jooq.Table<org.jooq.Record> table
    • jdbcQueueIndexer

      protected final JdbcQueueIndexer jdbcQueueIndexer
    • isShutdown

      protected Boolean isShutdown
  • Constructor Details

    • JdbcQueue

      public JdbcQueue(Class<T> cls, io.micronaut.context.ApplicationContext applicationContext)
  • Method Details

    • produceFields

      protected Map<org.jooq.Field<Object>,Object> produceFields(String consumerGroup, String key, T message)
    • emitOnly

      public void emitOnly(String consumerGroup, T message)
    • emit

      public void emit(String consumerGroup, T message)
      Specified by:
      emit in interface io.kestra.core.queues.QueueInterface<T>
    • emitAsync

      public void emitAsync(String consumerGroup, T message) throws io.kestra.core.queues.QueueException
      Specified by:
      emitAsync in interface io.kestra.core.queues.QueueInterface<T>
      Throws:
      io.kestra.core.queues.QueueException
    • delete

      public void delete(String consumerGroup, T message) throws io.kestra.core.queues.QueueException
      Specified by:
      delete in interface io.kestra.core.queues.QueueInterface<T>
      Throws:
      io.kestra.core.queues.QueueException
    • receiveFetch

      protected abstract org.jooq.Result<org.jooq.Record> receiveFetch(org.jooq.DSLContext ctx, String consumerGroup, Integer offset)
    • receiveFetch

      protected abstract org.jooq.Result<org.jooq.Record> receiveFetch(org.jooq.DSLContext ctx, String consumerGroup, String queueType)
    • updateGroupOffsets

      protected abstract void updateGroupOffsets(org.jooq.DSLContext ctx, String consumerGroup, String queueType, List<Integer> offsets)
    • receive

      public Runnable receive(String consumerGroup, Consumer<io.kestra.core.utils.Either<T,io.kestra.core.exceptions.DeserializationException>> consumer)
      Specified by:
      receive in interface io.kestra.core.queues.QueueInterface<T>
    • receive

      public Runnable receive(String consumerGroup, Class<?> queueType, Consumer<io.kestra.core.utils.Either<T,io.kestra.core.exceptions.DeserializationException>> consumer)
      Specified by:
      receive in interface io.kestra.core.queues.QueueInterface<T>
    • receiveTransaction

      public Runnable receiveTransaction(String consumerGroup, Class<?> queueType, BiConsumer<org.jooq.DSLContext,List<io.kestra.core.utils.Either<T,io.kestra.core.exceptions.DeserializationException>>> consumer)
    • receiveImpl

      public Runnable receiveImpl(String consumerGroup, Class<?> queueType, BiConsumer<org.jooq.DSLContext,List<io.kestra.core.utils.Either<T,io.kestra.core.exceptions.DeserializationException>>> consumer, Boolean inTransaction)
    • queueName

      protected String queueName(Class<?> queueType)
    • poll

      protected Runnable poll(Supplier<Integer> runnable)
    • map

      protected List<io.kestra.core.utils.Either<T,io.kestra.core.exceptions.DeserializationException>> map(org.jooq.Result<org.jooq.Record> fetch)
    • send

      protected void send(org.jooq.Result<org.jooq.Record> fetch, Consumer<io.kestra.core.utils.Either<T,io.kestra.core.exceptions.DeserializationException>> consumer)
    • pause

      public void pause()
      Specified by:
      pause in interface io.kestra.core.queues.QueueInterface<T>
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException