Not getting exception if the CB server is unavailable

I try to connect with my local CB but if the same server is not available then I see only warning message (no exception) while trying to insert document . I use spring data couchbase for CB operations.I override the couchbaseClusterEnviornment() method still dont see the exception.
Please suggest what needs to be done to get the exception.

@mreiche will it be possible to assist

Can you show the code that makes the call and the warning?
Thanks,
Mike

Thank you @mreiche for the quick response.
I override the couchbaseClusterEnviornment() method like:
public ClusterEnvironment couchbaseClusterEnviornment() {
return ClusterEnvironment.builder()
.timeoutConfig(
TimeoutConfig.connectTimeout(Duration.ofMillis(5))
).build();

}

Then my repo looks like:
public interface TestRepo extends ReactiveCrudRepository<Entity,String>{}

From service:
@Autowired TestRepo repo;
try{
repo.save(entity).subscribe();
}catch(Exception e){
sysout(“Failing…”);
}

I expect the sysout message but seeing warning message as:connect attempt15 failed because of : connection timeout:/127.0.0.1.8091 chcek server ports and cluster encryption settings

Use block() instead of subscribe(), or otherwise process the Mono returned by repo.save().

		try
		{
			Mono<Entity> saved = repo.save(entity);
			System.err.println("saved: "+saved.block());
		}catch(Exception e)		{
			System.err.println("Failing…"+ e);
		}

Failing…com.couchbase.client.core.error.AmbiguousTimeoutException: UpsertRequest, Reason: TIMEOUT {"cancelled":true,"completed":true,"coreId":"0xeb4aa5b100000001","idempotent":false,"lastDispatchedTo":"127.0.0.1","reason":"TIMEOUT","requestId":87,"requestType":"UpsertRequest","retried":14,"retryReasons":["ENDPOINT_NOT_AVAILABLE"],"service":{"bucket":"my_bucket","collection":"_default","documentId":"d64a007d-965c-4849-94cf-d0c65ec76825","opaque":"0x6a","scope":"_default","type":"kv","vbucket":52},"timeoutMs":2500,"timings":{"encodingMicros":25023,"totalMicros":2508633}}

subscribe() with no-args does not have any error handling:

/**

 * Subscribe to this {@link Mono} and request unbounded demand.
 * <p>
 * This version doesn't specify any consumption behavior for the events from the
 * chain, especially no error handling, so other variants should usually be preferred.
 *
 * <p>|
 * <img class=marble src=doc-files/marbles/subscribeIgoringAllSignalsForMono.svg alt=>
 *
 * @return a new {@link Disposable} that can be used to cancel the underlying {@link Subscription}
 */
public final Disposable subscribe() {

Yeah block() worked but I need to make the operation async then shall I use any err handling with subscribe() ?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.