Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Artavazd Balaian
    @REASY
    Thanks a lot @wsargent! Didn't know about export SOURCE_DATE_EPOCH=date +%s``
    Rory Graves
    @rorygraves
    Has anybody used AWS Cognito for user management in Play? Are there any code examples out there?
    Michael Rubin
    @mrubin
    Hello. Is anyone aware of any examples of compressing data that’s going out over a websocket (if the browser supports it)?
    Alexis Hernandez
    @AlexITC
    You can use protobuf as the serialization mechanism, which is quite compact, also, if you use nginx, it supports compressing the websocket messages: https://docs.nginx.com/nginx/admin-guide/web-server/compression/
    Brian Miller
    @bkmdev
    hi, using Play v2.6.21 for a web-gateway but still seeing requests to another micro-service that take >10 sec prematurely get timed-out by the web-gateway with a circuit breaker error :confused: My understanding was that this was fixed and made user configurable in v2.2.0 (see #1002) but I still seem to see this? Is there a way to configure this from the web-gateway's application.conf? I tried setting the below all to no avail :disappointed:
    akka.http.server.request-timeout = 30s
    promise.akka.actor.typed.timeout = 30s
    play.akka.actor.typed.timeout = 30s
    ws.timeout = 30s
    gavinbaumanis
    @gavinbaumanis
    Apologies if this has been asked before... is there an ETA for Play to be upgraded for Scala 3? : Thanks!
    Wilton
    @risenhoover
    Hi all - I am attempting to migrate from 2.6 to 2.7 but I am getting a very puzzling error message. The exception is java.lang.NoSuchMethodError: play.api.data.Form.bindFromRequest(Lplay/api/mvc/Request;)Lplay/api/data/Form; - when I look into this, it seems like that method should exist
    The stack trace includes at securesocial.core.providers.UsernamePasswordProvider.doAuthentication(UsernamePasswordProvider.scala:89)
    So basically my upgrade from 2.6 to 2.7 is stalled at this library issue - this smells like a library mismatch issue but not sure where to approach this.
    João Ferreira
    @jtjeferreira
    @risenhoover I suspect securesocial library does not support play 2.7...
    alexdarling
    @alexdarling

    Hi all, I've got a question about implementing a database listener in Play (Java). I'm trying to listen to postgres notifications and publish those to an event bus, so that some websocket actors can subscribe to what is going on in the DB.

    To do this, I'm thinking of creating an actor whose job is to run some database-listening code. Like:

    public DatabaseListenerActor(MyEventBus myEventBus) throws SQLException {
        Connection connection = DriverManager.getConnection(DB_URL, DB_USER, DB_PASSWORD);
        PGConnection pgConnection = connection.unwrap(org.postgresql.PGConnection.class);
        statement.execute("LISTEN some_notification_channel");
    
        while (true) {
            PGNotification[] notifications = pgConnection.getNotifications(10000);
            if (notifications != null) {
                Arrays.stream(notifications).forEach(myEventBus::publish);
            }
            Thread.sleep(SLEEP_TIME_MILLIS);
        }   
    }

    and then binding that with bindActor in my module.

    This doesn't actually work, though I'm not sure if that's because I messed up the implementation or if it's something to do with how actors operate. If I create a new thread with the same instructions, it seems to work fine.

    I feel like I have made a mistake by using actors for this, since the thread is just supposed to run forever and it never actually receives or sends messages. My guess is thatAkka has a way to handle database-listening, but actors are the wrong tool for the job.

    So I have 2 questions:
    (1) Am I right to use actors for this use case?
    (2) If not, is there another tool I should be using for monitoring database notifications?

    1 reply
    Will Sargent
    @wsargent
    use a stream
    there are some play example projects that will help here
    alexdarling
    @alexdarling
    ah that seems more appropriate
    so I should create something like a Source<PGNotification, NotUsed> that I can connect to a Sink like pgNotificationSource.runForEach(myEventBus::publish)
    Wilton
    @risenhoover
    @jtjeferreira I am using a fork that does support 2.7 - https://github.com/k4200/securesocial - in any case, the code should work because the method bindFromRequest does actually exist so why the error?
    Wilton
    @risenhoover
    @jtjeferreira i was finally able to track it down - it was in fact an issue with the code k4200/securesocial#18
    Sathyamoorthy R
    @sathyamoorthyrr
    Hi
    I am writing Test cases using ScalaTest in Play application for a Controller
      "Test" should {
        "not accept text/plain as Content-Type" in {
          val result: Accumulator[ByteString, Result] = controller.test().apply(
            FakeRequest(POST, "/test")
              .withHeaders(Headers(CONTENT_TYPE -> "text/plain"))
              .withTextBody(sampleJsonText)
          )
    It is returning Accumulator[ByteString, Result]
    How can I extract Result from it?
    Alexis Hernandez
    @AlexITC
    Take a look to this controller test, it should get you in the right direction
    Alexandre Roba
    @AlexandreRoba
    Hi all! I'm trying to setup the language in the URL while browsing the content of a site. I found this example https://stackoverflow.com/questions/32743911/play-framework-2-language-code-in-url-concept which is a bit outdated and was wondering if it exist an out of the box feature that does that? currently I can find the lang and have the MessageProvider returning the localized text. But I would like to have each request to to be redirected to something like host.com/EN or host.com/FR without having to change my routing... Any standard solution or example of this feature? Thanks for any help and have a great day.
    Will Sargent
    @wsargent
    you would typically do that with an EssentialFilter
    see the lang header and send a redirect response
    M K
    @manrax94_twitter
    Coming back to play after some time now but I can't get the java seed to run. I think it's because of bintray being in a brown-out session. What can I do to load the missing dependencies without bintray, since it's getting shut down anyway in May?
    Xiaorong Rao
    @RoyRaoxr
    Same issue as above.
    Rafael
    @rafaelkyrdan
    Hi guys,
    I have a question about running a gRpc service within play framework app.
I’m following this document https://developer.lightbend.com/docs/play-grpc/current/play/serving-grpc.html
and when I run it I got the error message:
    [jetty-alpn-agent] Could not find a matching alpn-boot JAR for Java version: 11.0.10
    Has anybody faced such issue? When I googled the message it is said that it shouldn’t be a case because since java9+ it should be supported.
    Do you know what I did wrong?
    Will Sargent
    @wsargent
    err... best thing you can do is post a gist or sample project, not enough info otherwise
    bintray deps will be moved to maven central
    NKM
    @nkmittal
    Hi folks,
    Facing this issue about performance: sometimes requests are timing out i.e. Play server logs don't show it. CPU utilization is mere 35% max. I am using Play 2.5. + scala 2.11.11 on Ubuntu 18 in a dockerised container.
    there are hardly 20 requests per sec arriving during peak traffic.
    It's AWS 2 vcpu EC2 instance. Memory usage is also normal.
    `default-dispatcher {
      # This will be used if you have set "executor = "fork-join-executor""
      type = "Dispatcher"
      executor = "fork-join-executor"
      fork-join-executor {
        # Min number of threads to cap factor-based parallelism number to
        parallelism-min = 8
    
        # The parallelism factor is used to determine thread pool size using the
        # following formula: ceil(available processors * factor). Resulting size
        # is then bounded by the parallelism-min and parallelism-max values.
        parallelism-factor = 3.0
    
        # Max number of threads to cap factor-based parallelism number to
        parallelism-max = 64
    
        # Setting to "FIFO" to use queue like peeking mode which "poll" or "LIFO" to use stack
        # like peeking mode which "pop".
        task-peeking-mode = "FIFO"
      }
    }
    `
    NKM
    @nkmittal
    this is application.conf section for akka.actor
    ritschwumm
    @ritschwumm
    @nkmittal can you try out using a 4 cpu one without too much trouble? i dimly remember having seen some similar issue a few years ago where some thread pool was limited to the number of cores and would have needed just one more available thread to proceed. if 4 cores works, you at least have a slightly better idea what you are looking for...
    NKM
    @nkmittal
    @ritschwumm sure, will try that.
    Meanwhile anyone has any suggestions and clues which I can try out ?
    Roman Parshikov
    @PromanSEW
    Hi! I have a question. I want to use Flash to deliver message to Twirl template, instead of parameter, but problem is that it is adding AFTER rendering. How to solve this problem? Or how to deliver simple message to template just using current request?
    Thierry MEYER
    @thitux_gitlab
    Hello everybody. I'am new to play framework. I'am a security consultant and currently auditing the security of a web app developp with this framework.
    The version used with this app is the 1.5.2. I cannot find the infromation concerning the end of support of this branch of the project. Maybe i did'nt search to the right place. Can someone tell me if only the branche 2.x is actively supported ? Thank you. (excus my english)
    Roman Parshikov
    @PromanSEW
    Thierry MEYER
    @thitux_gitlab
    Thank you Roman. So it's still supported.
    NKM
    @nkmittal
    @ritschwumm is there a way to log somewhere the client requests which are not accepted by the Play server ?
    ritschwumm
    @ritschwumm
    no idea, sorry
    Will Sargent
    @wsargent
    and put that in a filter
    and swap out the base negotiation logic