Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Gabriel Harris-Rouquette
@gabizou
I'm creating a set of services in Java with Lagom and I'd like to know if it's safe to try and use akka typed actors in lieu of the classic actors as the lagom guides currently explain. Specifically, I have a various series of other tasks that are parallelizable individually and I was hoping to experiment with using actors to do said work, but my biggest question overall is "Can I make use of Akka Typed Actors w/ Lagom?"
1 reply
Scalix
@akahanek
Hi, I am using the JDBC read side with Lagom 1.6.5 and Akka Typed Persistence. The serialization of events to the event journal is done in binary format, which has been repaired to plain text json in Akka Persistence JDBC plugin version 5.0.1. I would like to use the 5.0.1 plugin, but I do not know, how to use this plugin with Lagom 1.6.5. I have tried this (https://discuss.lightbend.com/t/how-to-use-akka-persistence-jdbc-plugin-5-0-1-with-lagom-1-6-5/8503), but with no success. Does anybody here have some hints, where to start, please?
cmolinah
@cmolinah
Hi, is it possible to use slick for read side in Java? I am not able to find the equivalent for this scala doc: https://www.lagomframework.com/documentation/1.5.x/scala/ReadSideSlick.html
2 replies
Guido Contreras Woda
@guiwoda
Hi! I'm starting a couple of services in Lagom and I need to configure unmanaged services to call to from these new services. I've found some documentation that says I need to create a Service with a Descriptor for the unmanaged service, then another documentation talks about the ServiceLocator class. Could anyone point me to an example or a tutorial that can help me?
Thanks!
greatmengqi
@greatmengqi
hello everyone! I have a question about lagom. what the use of describeService method from LagomApplicationLoader ?
greatmengqi
@greatmengqi
hello
SynappsGiteau
@SynappsGiteau

Hello,
When upgrading my Lagom version from 1.6.1 to 1.6.5, I get a runtime error when querying apis:

play.api.http.DefaultHttpErrorHandler [] - Error while handling error
java.lang.ClassCastException: sbt.internal.inc.MappedVirtualFile cannot be cast to java.io.File
        at com.lightbend.lagom.sbt.run.RunSupportCompat.$anonfun$sourceMap$1(RunSupportCompat.scala:74)
        at scala.collection.MapLike$MappedValues.get(MapLike.scala:260)
        at com.lightbend.lagom.dev.Reloader.$anonfun$findSource$1(Reloader.scala:389)
        at scala.Option.flatMap(Option.scala:271)
        at com.lightbend.lagom.dev.Reloader.findSource(Reloader.scala:388)
        at play.core.server.LagomReloadableDevServerStart$$anon$1$$anon$2.sourceOf(LagomReloadableDevServerStart.scala:186)
        at play.core.SourceMapper.$anonfun$sourceFor$1(ApplicationProvider.scala:21)
        at play.core.SourceMapper.$anonfun$sourceFor$1$adapted(ApplicationProvider.scala:21)
        at scala.collection.IndexedSeqOptimized.$anonfun$find$1(IndexedSeqOptimized.scala:53)
        at scala.collection.IndexedSeqOptimized.$anonfun$find$1$adapted(IndexedSeqOptimized.scala:53)
        at scala.collection.IndexedSeqOptimized.segmentLength(IndexedSeqOptimized.scala:198)
        at scala.collection.IndexedSeqOptimized.segmentLength$(IndexedSeqOptimized.scala:195)
        at scala.collection.mutable.ArrayOps$ofRef.segmentLength(ArrayOps.scala:198)
        at scala.collection.GenSeqLike.prefixLength(GenSeqLike.scala:98)
        at scala.collection.GenSeqLike.prefixLength$(GenSeqLike.scala:98)
        at scala.collection.mutable.ArrayOps$ofRef.prefixLength(ArrayOps.scala:198)
        at scala.collection.IndexedSeqOptimized.find(IndexedSeqOptimized.scala:53)
        at scala.collection.IndexedSeqOptimized.find$(IndexedSeqOptimized.scala:52)
        at scala.collection.mutable.ArrayOps$ofRef.find(ArrayOps.scala:198)
        at play.core.SourceMapper.sourceFor(ApplicationProvider.scala:21)
        at play.core.SourceMapper.sourceFor$(ApplicationProvider.scala:20)
        at play.core.server.LagomReloadableDevServerStart$$anon$1$$anon$2.sourceFor(LagomReloadableDevServerStart.scala:184)
        at play.api.http.HttpErrorHandlerExceptions$.$anonfun$convertToPlayException$1(HttpErrorHandler.scala:379)
        at scala.Option.flatMap(Option.scala:271)
        at play.api.http.HttpErrorHandlerExceptions$.convertToPlayException(HttpErrorHandler.scala:379)
        at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:373)
        at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:264)
        at play.core.server.Server$$anonfun$handleErrors$1$1.applyOrElse(Server.scala:109)
        at play.core.server.Server$$anonfun$handleErrors$1$1.applyOrElse(Server.scala:105)
        at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38)
        at play.core.server.Server$.getHandlerFor(Server.scala:129)
        at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:317)
        at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:224)
        at akka.stream.impl.fusing.MapAsync$$anon$30.onPush(Ops.scala:1297)

Lagom 1.6.5
Scala 2.12.13
Sbt 1.4.7
Java 8 (same problem when compiling/running on Java 11)

Thank you for your help.

1 reply
Bartosz Kumorek
@Randerspl

Hello i have a question about ServiceCall composition.
For example when writing composition for authentication i want to add response header (for example "Set-Cookie" to refresh after successfull authentication).
I found function handleResponseHeader that i can use on serviceCall but this function wants only T type as result without header. Can i edit response header here or i need to pass parameters to serviceCall function and set header for every ServerServiceCall below which uses this function?

Below example code:

ServerServiceCall.composeAsync { requestHeader =>
    val user:Option[User] = getUser()
    if(user.isDefined){
        serviceCall( user ) // here i would like to add header
    }else{
        throw Forbidden("You cannot")
    }
}
Gabriel Harris-Rouquette
@gabizou
Eder Ruiz
@drrzmr
Hello, I have a question about Content-Type. I do a simple request using curl without content-type, and I see in ServerServiceCall the content-type: application/octet-stream, I'm tring use a message serializer that use a json serializer/deserializar for requests that not pass the content-type (there are a client that do this :/). I think that is possible to use json for octet-stream, but it's a ugly solution in my opinion. There are somo way to configure lagom to not overwrite a empty content-type request?
1 reply
ldeck
@ldeck
Hi all — (newby) our of interest, what might be the usual cadence of releases for lagom? I notice the last release seemed to be 2019. Is it still actively moving forward?
Michael Ahlers
@michaelahlers
@ldeck, as a long-time Lagom user, I’ve wondered that myself. Lightbend, last I checked, seems to have stripped all mention of Lagom (and Play) from its site with all emphasis on Akka. Of course, Lagom is an opinionated amalgamation of various Akka projects, all of which are actively maintained and supported.
ldeck
@ldeck
Thanks @michaelahlers. Good to know. Be nice, of course, to know if it’s still part of their strategy as it appears to be a very nice opinionated framework.
sfsmicm
@sfsmicm
I'm also very concerned about the release frequence of lagom - especially if i look at the contributions in gitlab: https://github.com/lagom/lagom/graphs/contributors
Would be nice the hear a statement of lightbend about the future of lagom.
Sriram Sundharesan
@sriramsundhar

hey.. When I try a subscribe only service as mentioned here
https://www.lagomframework.com/documentation/1.6.x/java/KafkaClient.html#Subscriber-only-Services
I see this..

1) No implementation for com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry was bound.
  while locating com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry
    for the 4th parameter of com.lightbend.lagom.internal.javadsl.persistence.ReadSideImpl.<init>(ReadSideImpl.scala:39)
  at com.lightbend.lagom.javadsl.persistence.PersistenceModule.bindings(PersistenceModule.scala:20):
Binding(class com.lightbend.lagom.internal.javadsl.persistence.ReadSideImpl to self) (via modules: com.google.inject.util.Modules$OverrideModule -> play.api.inject.guice.GuiceableModuleConversions$$anon$4)

1 error
    at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:554)
    at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:161)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:108)
    at com.google.inject.Guice.createInjector(Guice.java:87)
    at com.google.inject.Guice.createInjector(Guice.java:78)
    at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:200)

am I missing something?

1 reply
Levi Ramsey
@leviramsey
This message was deleted
1 reply
Jeremy Pollock
@jpollock
Hi! Jeremy Pollock here. I head up product at lightbend. I won’t drop an answer in here quite yet. But I did want to say that I saw the questions and comments and will come back with some directional thoughts from the company. @leviramsey thanks for the YouTube video link; we saw as well and we were scratching our heads as to how that happened. Also, I’m happy to talk to developers using Lagom directly. You can reach me at jeremy.pollock@lightbend.com. Thanks!
1 reply
Boon
@laiboonh

Hi all. I am a beginner playing with lagom and following the documentation. I tried to experiment replacing cassandra with postgres using JdbcPersistenceComponents. However i get this error on bootup and when calling the service

07:40:33.865 [error] hello [] - Exception in PathCallIdImpl(/api/hello/:id)
akka.pattern.AskTimeoutException: Ask timed out on [EntityRef(EntityTypeKey[org.example.hello.impl.HelloCommand](HelloAggregate), bob)] after [5000 ms]. Message of type [org.example.hello.impl.Hello]. A typical reason for `AskTimeoutException` is that the recipient actor didn't send a reply.

I tried to debug. It seems that after ref.ask[Greeting](replyTo => Hello(id, replyTo)) the aggregate never receive the message.
I ran out of ideas. Can someone help me understand whats wrong? My changes are https://github.com/laiboonh/lagom-hello/commit/6cfb2ffaa8a68baece34fc4519fd8c24172cbb1f#diff-901e3f581fbf1e34ad47779f618f30e0f8afc3e7f645ff665fd353c784cb1f2e

Boon
@laiboonh
Things worked after i took out cassandra dependency...Mind Blown! Having unused dependency shouldn't matter
libraryDependencies ++= Seq(
//      lagomScaladslPersistenceCassandra,
      lagomScaladslKafkaBroker,
      lagomScaladslTestKit,
      macwire,
      scalaTest,
      lagomScaladslPersistenceJdbc,
      postgres
    )
Guido Contreras Woda
@guiwoda
Any design recommendations on how to store authentication state when calling unmanaged services from a lagom service? (i.e. access token from a service login call)
1 reply
schrepfler
@schrepfler:matrix.org
[m]
how do I change the default actor system name in a Lagom application? I'd like to customise the "sourceActorSystem=application" thing that I see sometimes
[warn] a.s.s.RestartWithBackoffSource [akkaAddress=akka://application@10.10.10.10:25520, sourceThread=application-akka.actor.default-dispatcher-15, akkaSource=RestartWithBackoffSource(akka://application), sourceActorSystem=application, akkaTimestamp=10:07:06.606UTC] - Restarting graph due to failure. stack_trace:
schrepfler
@schrepfler:matrix.org
[m]
I will note that Service.named() is set to something other than "application"
Guido Contreras Woda
@guiwoda
How do I spawn an actor with Lagom + Akka typed? I'm using Akka Distributed Data and I don't understand where can I spawn the actor that implements it.
3 replies
Sriram Sundharesan
@sriramsundhar
hey!! we are trying out akka EventSourcedBehaviorWithEnforcedReplies and want to use lightbend telemetry to publish some custom metrics.. but am not find how I can access the akka system... Is there a way I can access akka system or push an ActorRef into EventSourcedBehaviorWithEnforcedReplies implementation?
1 reply
Srepfler Srdan
@schrepfler
Hi, I'm trying to stick the akka persistence cassandra Cleanup utility into a Service, I inject the ActorSystem in the constructor but upon invoking at deploy I get an exception saying materializer() doesn't exist on ActorMaterializer
Error injecting constructor, java.lang.NoSuchMethodError: 'akka.stream.ActorMaterializer akka.stream.SystemMaterializer.materializer()'
  at tech.api.impl.MarketsServiceImpl.<init>(MarketsServiceImpl.java:42)
  at com.lightbend.lagom.javadsl.server.ServiceGuiceSupport$LagomServiceBuilder.bind(ServiceGuiceSupport.java:134) (via modules: com.google.inject.util.Modules$OverrideModule -> tech.api.impl.MarketsModule)
  while locating tech.api.impl.MarketsServiceImpl
Caused by: java.lang.NoSuchMethodError: 'akka.stream.ActorMaterializer akka.stream.SystemMaterializer.materializer()'
sfsmicm
@sfsmicm

Hi all! Ive got a question about the lagom-event-streams which are emitted to kafka. Some events were missing - at first i thought that there was a problem with the consumer but i discovered that the missing events had not been published to the topic (but i saw them in the eventstore). I'm using 10 TAGs and today 9 of the TopicProducers had no lag whereas 1 Produced was stalled (i saw this in the read_side_offsets table of persistencejdbc. 9 topics on a offset of about 247xxx... 1 topic still on offset 244xxx).

I searched the logs but could not locate any messages indicating a problem.

The problem itself disappeared when i restarted both nodes of the cluster of this specific persistententity. (unfortunately i missed to check whether the problem resolved after restarting 1 of the 2 nodes).

can anybody drop me a hint what i can do if this problem occurs again?

Srepfler Srdan
@schrepfler
What I reported above with no materializer() method, can this be some sort of MiMa issue? It sounds similar to this error akka/akka#25449
Srepfler Srdan
@schrepfler
Okay, we copy/pasted Cleanup.scala into our project from akka-persistence-cassandra 0.106 at that point it works, perhaps because akka-persistence-cassandra uses jdk8 and there's some binary compatibility issue?
I need to check who owns it and report upstream
Scott Lyons
@slyons
So, trying to get back into Akka/Lagom after a few years away. The new project g8 doesn't work, the lagom-sbt-plugin package doesn't seem to exist anywhere
Levi Ramsey
@leviramsey
I would honestly suggest looking into Akka Typed (including the typed variants of Persistence and Cluster Sharding... combined, they're kind of a different spin on a lot of Lagom ideas), which (being the backbone of Akka Serverless) likely has a bit more of a future than Lagom
1 reply
(and doesn't rely on build-system plugins)
Scott Lyons
@slyons
Much obliged! I figured out the issue as being a Scala/Java version mismatch
brabo-hi
@brabo-hi
Hi all on a lagom service, how to handle unknown http path? it always return play framework Action Not Found response. I would like to customise the response
Robert D. Blanchet Jr.
@blanchet4forte

For Lagom service descriptor can I have an endpoint with a query string parameter that is defaulted to a value or do I have to specify it as Option?
eg. can I do this?

trait MyService extends Service {
   def myEndpoint(foo: String, bar: String = "someValue")

   override def descriptor: Descriptor = {
      // ....
      restCall(Method.GET, "whatever/:foo?bar", myEndpoint _)
   }
}

And call it like this: myService/whatever/test

1 reply
Bartosz Kumorek
@Randerspl
Hello,
im getting errors when building in Intellij that on lagom 1.6.7 scala-java8-compat is suspected to be bnary incompatible.
1 reply
image.png
I should be worried or ignore this? Compiling via sbt is ok.
Rory
@bagf
Hey everyone! I've noticed a error in some of our Lagom 1.5 builds where it seems the sbt plugin artifact isn't available, did a quick search: https://search.maven.org/artifact/com.lightbend.lagom/lagom-sbt-plugin and seems only 1.6 is listed there. Is there an alternative resolver I should add? thanks
Harry Tran
@pertsodian

Hello. I have a need to consume from a kafka topic (still within same cluster, but not published via events).

Documentations suggest that I create an ExternalKafkaService with the topic defined in its descriptor, then I can write my subscriber as usual. This works, but I'm just wondering if we have any way to not depending on Lagom for this purpose.

  logger.info("Starting the subscriber")
  externalKafkaService.externalTopic.subscribe.atLeastOnce(Flow[ExternalRequest].mapAsync(1) {
    request =>
      logger.info("Executing {}", request)
      Future.successful(Done)
  })

If I implement the subscriber like this, I can see the "starting" log on startup, but not the "executing" log when I produce the messages to the topic (works fine if using Lagom way)

  private val consumerSettings = ConsumerSettings(actorSystem, new StringDeserializer, new StringDeserializer)

  logger.info("Starting the subscriber")
  Consumer
    .plainSource(consumerSettings, Subscriptions.topics(ExternalTopic))
    .mapAsync(1)(message => {
      val request = Json.parse(message.value).as[ExternalRequest]
      logger.info("Executing {}", request)
      Future.successful(Done)
    })
    .run()

Could you help me understand what is missing in 2nd approach? Is there any preferences/advantages to use Lagom way instead, even if we can make 2nd approach work? (I can change 2nd approach to use commitableSource to achieve the atLeastOnce behaviour later)
Thank you in advance.

2 replies
Sathya R
@sathyarr
Hi, I have all my web projects in Play framework. Now, planning to bring in Lagom framework for deployments as it is easy to integrate with Cassandra and Apache Kafka. Can I just import my existing Play projects directly into Lagom? or should I rewrite according to Lagom structure? or atleast, how does things work?
1 reply
Canislupax
@Canislupax
hi all: when i switch to lagom 1.6.7 i got a (lagom-internal-meta-project-service-locator / update) found version conflict(s) in library dependencies; some are suspected to be binary incompatible: error
org.scala-lang.modules:scala-java8-compat_2.12:1.0.2 (early-semver) is selected over {0.8.0, 0.9.1, 0.9.1, 0.9.1}
[error] +- com.lightbend.lagom:lagom-akka-management-core_2.12:1.6.7 (depends on 1.0.2)
[error] +- com.lightbend.lagom:lagom-javadsl-jackson_2.12:1.6.7 (depends on 1.0.2)
[error] +- com.lightbend.lagom:lagom-api_2.12:1.6.7 (depends on 1.0.2)
[error] +- com.lightbend.lagom:lagom-dev-mode-ssl-support_2.12:1.6.7 (depends on 1.0.2)
[error] +- com.lightbend.lagom:lagom-scaladsl-play-json_2.12:1.6.7 (depends on 1.0.2)
[error] +- com.lightbend.lagom:lagom-logback_2.12:1.6.7 (depends on 1.0.2)
[error] +- com.lightbend.lagom:lagom-service-registry-client-core_2.12:1.6.7 (depends on 1.0.2)
[error] +- com.typesafe.play:play-ahc-ws-standalone_2.12:2.1.6 (depends on 1.0.2)
[error] +- com.typesafe.play:play_2.12:2.8.11 (depends on 0.9.1)
[error] +- com.typesafe.play:play-streams_2.12:2.8.11 (depends on 0.9.1)
[error] +- com.typesafe.play:play-java_2.12:2.8.11 (depends on 0.9.1)
[error] +- com.typesafe.akka:akka-actor_2.12:2.6.17 (depends on 0.8.0)
using the standard hello world example with no modifications
1.6.5 working finde
1 reply
Bartosz Kumorek
@Randerspl

Hello i have a question about lagom topic pubSub and websocket.
For example i have simple endpoint :

def websocket: ServerServiceCall[ NotUsed, Source[ String, NotUsed ] ] =  ServerServiceCall { ( _, _ ) =>
    val topic = pubSub.refFor( TopicId[ TopicMessage ]( "SomeTopic" ) )

    val stream = topic.subscriber.log( "WS", x => {
        log.warn( s"sending WS message $x" )
    } )
    .withAttributes( Attributes.logLevels( onElement = Logging.InfoLevel, onFinish = Logging.WarningLevel ) )

    Future.successful( (ResponseHeader.Ok, stream) )
}

How to detect that websocket disconnected or ended?
For example i need to detect if WS disconnected and save information about it.
I can see that .log function from akka stream with attributes detects that downstream has ended and logs about it.
I tried handling with .recover{} or via Sink.onComplete but nothing happened.

Any tips?

1 reply
Marin Vila
@rinmalavi
Hi all, is it possible to set jmx port to lagom? Just trying to make a simple service and tring to see how would i export some simple metrics, at first in runAll. Simply adding those com.sun.management.jmxremote settings to javaOptions doesn't seem to work. Probably missing some scope or something.
Robert D. Blanchet Jr.
@blanchet4forte
I'm trying to run ServiceTest.startServer using ServiceTest.defaultSetup.withJdbc(true) and i'm getting an error "DefaultDB not found". I've got other services that I've written that do this and it works just fine. I've been up and down the configurations and build.sbt and I can't for the life of me figure out what is different
Brian Miller
@bkmdev
General question here about this distributed Lagom framework (especially with Kafka in the middle)- and apologies if this is "dumb", but does Lagom not have a mechanism by which it back-propagates statuses to the call originator when there is more than 1 service entity in the chain? (I am not seeing able to find anything in the documentation nor forums about this) or is this left as an "exercise to the reader" to implement a validation check at the originator? or at each party in the chain to check its downstream peer?