Thank you Pavel for the quick response so from the queue user perspective
transactions are not applicable.
Interestingly my quick test did not raise an exception simply added 2 items

final IgniteQueue<Value> queue = ignite.queue("myQueue", 8, new
CollectionConfiguration()
    .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
    .setCacheMode(CacheMode.REPLICATED)
    .setBackups(4)
    .setCollocated(true)
);

          IgniteTransactions transactions = node.transactions();
          try (Transaction tx = transactions.txStart()) {
            for (int i = 0; i < 2; i++) {
              System.out.println("Queue Adding one entry ");
              queue.put(new Value(id.incrementAndGet(), "Queue node"));
            }
            tx.rollback();
//            tx.commit();
          }



On Thu, Jun 5, 2025 at 12:57 AM Pavel Tupitsyn <ptupit...@apache.org> wrote:

> Hello,
>
> With a transactional queue (CollectionConfiguration.atomicityMode =
> TRANSACTIONAL), the queue implementation starts a transaction
> internally [1].
>
> If a transaction already exists in the current thread, queue operation
> will fail with "Failed to start new transaction (current thread
> already has a transaction)" [2]
>
>
> [1]
> https://github.com/apache/ignite/blob/ee955df9fb80737292aac5f7ad3c82f8f0d8ea8e/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java#L56
> [2]
> https://github.com/apache/ignite/blob/297bc9cc470c569d4c0e6ed12c734e3b92bc3d58/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java#L194
>
> On Thu, Jun 5, 2025 at 5:24 AM Alex Roytman <roytm...@gmail.com> wrote:
> >
> > Hello,
> >
> > Can Ignite 2.0 queue be transactional and if so what does it mean?
> > If a thread starts a transaction will it block the queue for other
> threads/clients?
> > If a thread rolls back its transaction will it return the taken item(s)
> the queue? In what place on the queue?
> >
> > Thank you,
> > Alex
> >
>

Reply via email to