Uploaded image for project: 'Couchbase Java Client'
  1. Couchbase Java Client
  2. JCBC-1988

Need to access TransactionMarkerOwner.marker without block()

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Declined
    • Major
    • None
    • None
    • None
    • None
    • 1

    Description

      Edit: I think the issue in https://github.com/spring-projects/spring-data-couchbase/issues/1527 is due to the customer not having @EnableTransactionManagement in the class that extends AbstractCouchbaseConfiguration.

      ---------------------------------------------------------

      This is to resolve https://github.com/spring-projects/spring-data-couchbase/issues/1527

      in a non-blocking thread, calls to TransactionalSupport.checkForTransactionInThreadLocalStorage().block().isPresent() fail with.

      For reactive transactions, I can use :

      	public static Optional<CouchbaseResourceHolder> checkForTransactionInThreadLocalStorage(ContextView ctx) {
      		return Optional.ofNullable(ctx.hasKey(TransactionMarker.class) ? new CouchbaseResourceHolder(ctx.get(TransactionMarker.class).context()) : null);
      	}
      

      But for non-blocking transactions - there is no way to access TransactionMarkerOwner.marker without calling

      TransactionalSupport.checkForTransactionInThreadLocalStorage().block()
      

      java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-3
      	at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:83) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
      	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
      Error has been observed at the following site(s):
      	*__checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
      	*__checkpoint ⇢ HTTP POST "/schedule" [ExceptionHandlingWebHandler]
      Original Stack Trace:
      		at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:83) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
      		at reactor.core.publisher.Mono.block(Mono.java:1675) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
      		at org.springframework.data.couchbase.transaction.CouchbaseCallbackTransactionManager.handlePropagation(CouchbaseCallbackTransactionManager.java:191) ~[spring-data-couchbase-5.0.0-M5.jar:5.0.0-M5]
      		at org.springframework.data.couchbase.transaction.CouchbaseCallbackTransactionManager.execute(CouchbaseCallbackTransactionManager.java:76) ~[spring-data-couchbase-5.0.0-M5.jar:5.0.0-M5
      

      ]

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            michael.reiche Michael Reiche
            michael.reiche Michael Reiche
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty