interface - Java - Akka project best practices -


i have java project built around actor system. 1 of actor needs use third party service through java api wrote. want know if having java interface , utility java class interacts actor practice in akka world?

myactor.java

public class myactor {  @override  public void onreceive(obj o) throws exception {      ..       .. else using myutility.java      .. send message  } public class myutility implements itsiterface {  ... blah }  interface itsinterface {   .. blah } 

is approach?

i'd far actor systems go, depending on 3rd party service seems quite natural no-one can expect work in isolation.

as far interface goes, don't how relevant actor uses utility class implementation directly. without knowing more myutility, if contains state , not used used exclusively actor usual concurrency problems arise.

though using 3rd party service quality lies outside of controls results in potential issues , requires design reflect this:

  • actors blocking on message discouraged due potential performance/scalability issues.
  • simply using futures within actor prevent blocking transfers bottleneck actor future. true if push i.e. insert messages without asking system if can handle additional messages (back-pressure) .
  • queues don't fix overload nice article dealing load in queues in general.
  • it might worth thinking putting 3rd party service in separate actor , use circuit breaker in case service unreliable.
  • an actor seldom has same lifecycle service uses, 1 needs think consequences.

hope helps.


Comments