Hi Mateusz,

It’s not supported since IgniteSet/IgniteQueue operations are always executed 
in their own internal transaction. To my knowledge there are no plans to change 
this architectural design.

—
Denis

> On Jul 20, 2016, at 10:01 AM, mateusz <[email protected]> wrote:
> 
> Hello Ignite Users,
> 
> in
> https://apacheignite.readme.io/docs/queue-and-set#collection-configuration
> is stated, that the underlying cache for IgniteQueue can be transactional.
> Since the underlying cache is an implementation detail, I expected the
> IgniteQueue, configured with a transactional underlying cache, to be
> transactional itself. Unfortunately, this is not the case. 
> 
> I've added a test also using a IgniteCache as comparison (where a
> modification is rolled back) to the IgniteQueue (where a modification is not
> rolled back).
> 
> @Test
> public void transactionalAddToQueueCanBeRolledBack() throws Exception {
>       // given
>       Ignite ignite = Ignition.start();
> 
>       CacheConfiguration<Integer, String> cacheConfig = new
> CacheConfiguration<>();
>       cacheConfig.setName("cache" + System.currentTimeMillis());
>       cacheConfig.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
>       IgniteCache<Integer, String> cache = 
> ignite.getOrCreateCache(cacheConfig);
> 
>       CollectionConfiguration queueConfig = new CollectionConfiguration();
>       queueConfig.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
>       IgniteQueue<String> queue = ignite.queue("queue" +
> System.currentTimeMillis(), 0, queueConfig);
> 
>       // when
>       Transaction txStart =
> ignite.transactions().txStart(TransactionConcurrency.PESSIMISTIC,
>                       TransactionIsolation.SERIALIZABLE);
>       cache.put(1, "foo");
>       queue.add("foo");
>       txStart.rollback();
> 
>       // then
>       assertEquals(0, cache.size());
>       assertEquals(0, queue.size()); // AssertionError: expected: <0> but was:
> <1>
> }
> 
> The same happens using IgniteSet.
> 
> Is the adding supposed to be transactional in this case?
> 
> Kind regards
> Mateusz
> 
> 
> 
> 
> --
> View this message in context: 
> http://apache-ignite-users.70518.x6.nabble.com/Transactional-adding-to-IgniteQueue-and-IgniteSet-tp6410.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to