Last active
January 29, 2021 22:13
-
-
Save itzg/d81b1ac9545b65f26da314b56875c5e9 to your computer and use it in GitHub Desktop.
What happens when two smallrye incoming methods declared without broadcast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.smallrye.mutiny.Multi; | |
import java.time.Duration; | |
import java.time.Instant; | |
import javax.enterprise.context.ApplicationScoped; | |
import org.eclipse.microprofile.reactive.messaging.Incoming; | |
import org.eclipse.microprofile.reactive.messaging.Outgoing; | |
@ApplicationScoped | |
public class Chatty { | |
@Outgoing("ticks") | |
//Uncomment the following to declare the interactions correctly | |
//@Broadcast | |
public Multi<String> ticker() { | |
return Multi.createFrom().ticks().every(Duration.ofSeconds(1)) | |
.onItem().transform(tick -> Instant.now().toString()); | |
} | |
@Incoming("ticks") | |
public void handler1(String tick) { | |
System.out.printf("handler1: %s%n", tick); | |
} | |
@Incoming("ticks") | |
public void handler2(String tick) { | |
System.out.printf("handler2: %s%n", tick); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
App fails to start with