Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FluxPublish does not propagate subscriber context #1968

Closed
andreisilviudragnea opened this issue Nov 21, 2019 · 0 comments
Closed

FluxPublish does not propagate subscriber context #1968

andreisilviudragnea opened this issue Nov 21, 2019 · 0 comments

Comments

@andreisilviudragnea
Copy link
Contributor

Expected Behavior

FluxPublish should propagate the first subscriber context, as, for example, FluxReplay does, after #1114 got fixed.

Actual Behavior

FluxPublish does not propagate any subscriber context.

Steps to Reproduce

@Test
public void subscriberContextPropagation() {
	String key = "key";
	int expectedValue = 1;
	Flux<Integer> integerFlux =
			Flux.just(1, 2, 3)
			    .flatMap(value ->
					    Mono.subscriberContext()
					        .doOnNext(context -> assertThat((int) conte
							        .isEqualTo(expectedValue)
					        )
					        .thenReturn(value)
			    )
			    .publish()
			    .autoConnect(2);
	integerFlux.subscriberContext(Context.of(key, expectedValue))
	           .subscribe();
	integerFlux.subscriberContext(Context.of(key, 2))
	           .subscribe();
}

Possible Solution

Override CoreSubscriber.currentContext() in FluxPublish.PublishSubscriber:

@Override
public Context currentContext() {
	return Operators.multiSubscribersContext(subscribers);
}

Your Environment

  • Reactor version(s) used: 3.3.0.RELEASE
  • Other relevant libraries versions (eg. netty, ...):
  • JVM version (javar -version):
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (Zulu 8.42.0.21-CA-macosx) (build 1.8.0_232-b18)
OpenJDK 64-Bit Server VM (Zulu 8.42.0.21-CA-macosx) (build 25.232-b18, mixed mode)
  • OS and version (eg uname -a):
Darwin 192-168-0-196.rdsnet.ro 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64
andreisilviudragnea added a commit to andreisilviudragnea/reactor-core that referenced this issue Nov 21, 2019
According to issue reactor#1114, it looks like the FluxPublish
operator should propagate the first subscriber context too.
andreisilviudragnea added a commit to andreisilviudragnea/reactor-core that referenced this issue Nov 21, 2019
According to issue reactor#1114, it looks like the FluxPublish
operator should propagate the first subscriber context too.

Related issues: reactor#1114
andreisilviudragnea added a commit to andreisilviudragnea/reactor-core that referenced this issue Nov 24, 2019
According to issue reactor#1114, it looks like the FluxPublish
operator should propagate the first subscriber context too.

Related issues: reactor#1114
@simonbasle simonbasle added this to the 3.2.13.RELEASE milestone Nov 25, 2019
simonbasle added a commit that referenced this issue Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants