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

akka-typed: provide Java-Support for accessing the Event-Stream #29398

Closed
domdorn opened this issue Jul 17, 2020 · 1 comment
Closed

akka-typed: provide Java-Support for accessing the Event-Stream #29398

domdorn opened this issue Jul 17, 2020 · 1 comment
Milestone

Comments

@domdorn
Copy link

domdorn commented Jul 17, 2020

At the moment, its quite hard from Java to access the event-stream.
I had to come up with this code to subscribe to events (inside a typed actor):

          ClassTag<ScenarioEvent> classTag = ClassTag$.MODULE$.apply(ScenarioEvent.class);
          ActorRef<ScenarioEvent> scenarioEventToWrapperAdapter =
              ctx.messageAdapter(ScenarioEvent.class, e -> WrappedScenarioEvent.of(e));
          EventStream.Subscribe<ScenarioEvent> subscribe1 =
              new EventStream.Subscribe(scenarioEventToWrapperAdapter, classTag);
          ctx.getSystem().eventStream().tell(subscribe1);

Probably the easiest way to get this working would be to provide a EventStream.Subscribe constructor that accepts a Class<T> instead of a ClassTag<T>

provide a simple Java API to do the same.

@domdorn
Copy link
Author

domdorn commented Jul 17, 2020

Please ignore.. I just found out EventStream.Subscribe has a constructor for java.. don't know how I could not have seen that one.

@domdorn domdorn closed this as completed Jul 17, 2020
@johanandren johanandren added this to the invalid milestone Jul 20, 2020
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