Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 05:28
    @jameskleeh banned @zxvdgs:jonasled.de
  • Jan 07 17:44
    @jameskleeh banned @GrantEllison15_twitter
  • Jan 06 01:27
    @jameskleeh banned @brittapop_twitter
  • Jan 06 01:19
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 18:47
    @jameskleeh banned @orubel
  • Jan 04 18:46
    @jameskleeh banned @orubel
  • Jan 04 18:41
    @jameskleeh banned @orubel
  • Jan 04 18:39
    @jameskleeh banned @orubel
  • Jan 04 18:32
    @jameskleeh banned @orubel
  • Jan 04 18:31
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 18:30
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 18:28
    @jameskleeh banned @orubel
  • Jan 04 18:23
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 18:20
    @jameskleeh banned @orubel
  • Jan 04 18:10
    @jameskleeh banned @BeApi_io_twitter
  • Apr 03 2020 13:09
    @jameskleeh banned @orubel
  • Mar 30 2020 18:40
    @graemerocher banned @BeApi_io_twitter
  • Mar 30 2020 08:44
    @graemerocher banned @orubel
Denis Stepanov
@denisstepanov:matrix.org
[m]
It also depends if you use Hibernate or Micronaut Data Jdbc R2dbc
Dmitry Polovka
@message
Okay, there was a mess, I also had persistence-api:2.2.3in a classpath. Thank you for your help, sorry.
Robert Sjödahl
@Discordia
Is there a way to get the raw request body from a HttpReqeust<?>?
As bytes?
In a HttpServerFilter
And we are on Micronuat 2.x. Not yet upgraded to Micornuat 3.x.
Jouper
@JouperCoding

Morning Micronaut,

I was looking into the Micronaut Micrometer setup to see if there was any default metrics that could be enabled to figure out how long it takes for micronaut to boot, however the only one I found and tested was "process.start.time" which unfortunately didn't seem to be a metric for that specifically.

Is there a pre defined metric to get the same time that is logged when micronaut is booted locally, i.e

Startup completed in 6286ms. Server Running: http://localhost:54021

But as a metric?

If that doenst exits, what would be the recommended way to get that time into a metric during boot?

The use case for this, is that I would like to have this metric since we are running serverless as an AWS lambda function and it would be nice to monitor our cold starts and how many cold starts that happens overtime.

James Howe
@jhoweaa

I recently switched my environment from 3.1.4 to 3.2.0. Now when I run ./gradlew compileJava, I see this warning:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

If I switch back to 3.1.4, I do not see this warning. The only change is in my gradle properties where I use 3.1.4 instead of 3.2.0. Is there some other change I need to make sure I'm making to use 3.2.0?

James Kleeh
@jameskleeh
No
Its just a warning. It will go away in the next release
Rafael Solci
@rsolci
Hi folks.
Did anyone integrated a micronaut (with kafka) application with datadog?
I followed some guides and now REST endpoints are tracked normally with traces. But our kafka listeners dont trigger any trace. Datadog claims that the kafka integration is enabled by default. Do I have no configure each listener in order for my classes appear on traces?
Robert Sjödahl
@Discordia
Is there wa way in Micronaut 2 to log out the request body when a client sends invalid JSON, preferable in a HttpServerFilter? Right now it looks like the HttpReqeust<?>.getBody(String.class) does not give anything if the body was not parasable?
James Kleeh
@jameskleeh
The body is read after filters are executed
what exception is thrown in that case?
Robert Sjödahl
@Discordia
no exception, just an empty optional
  long contentLength = request.getContentLength();
        if (mediaType != null && contentLength > 0) {
            Object body = request.getBody(String.class).orElse(null); // this gives null since empty optional, but contentLength > 0
            if (mediaType.getSubtype().equals(MediaType.EXTENSION_JSON)) {
                if (body == null) {
                    LOGGER.info(() -> "Request validation failed, unable to parse json "
                        + request.getBody(String.class).orElse(""));
                    return Publishers.just(HttpResponse.badRequest());
                }
            } 
Patrick Lightbody
@lightbody
What's the best way to read the body of an incoming JSON POST payload and NOT have Jackson involved in auto-parsing it? That is, I just want the String or InputStream directly.
(this is for a controller of course)
would a @Body InputStream is parameter work? I don't think @Body String s does?
should I inject the HttpRequest<?> request in the parameters and then call getBody(InputStream.class)? :shrug:
James Kleeh
@jameskleeh
String does work
So does inputstream
And byte[]
Patrick Lightbody
@lightbody
Hmm... I recall having strange problems with content-type mismatches giving me grief (like it expecting a plain text string but my API providing json contnet-type, so we get a 404)
Maybe I'm dreaming
I'll try!
James Kleeh
@jameskleeh
The content type still needs to match
The content type and the body argument are not linked in that way
Neev Shultz
@neev887766_gitlab
Hi - when I try installing micronaut on my macbook pro I get this message:
Stop! micronaut 3.2.0 is not available. Possible causes:
 * 3.2.0 is an invalid version                                 
 * micronaut binaries are incompatible with your platform      
 * micronaut has not been released yet
I'm guessing this because I have a M1/ARM64 processor... I did try setting sdkman_rosetta2_compatible=true but the problem persists. Anyone knows how to fix this?
Neev Shultz
@neev887766_gitlab
Nevermind - just had to restart and the sdkman_rosetta2_compatible=true option now works
Ben Tomasini
@btomasini

Hi. I am running integration tests with Micronaut Data and PostgresQL. I am encountering two related issues: 1) the tests are rather slow because the context is loaded up each time, and 2) after a number of tests, the database can't accept any more connections - I think because the database pool is created multiple times and reserving many connections.

I have read of similar issues with Sprint Boot.

Is there a way for me to replace the default DataSource for test only? I would probably store an instance statically to reuse across test runs.

2 replies
Matthew Planchant
@mplanchant
Is there a micronaut equivalent of UrlEncodedFormEntity? I'm trying to POST an encoded form entity but It's not obvious how I do this?
Robert Sjödahl
@Discordia
Is there a way to intercept a HTTP request on the netty level?
James Kleeh
@jameskleeh
@Discordia yes it’s in the docs
Robert Sjödahl
@Discordia
Ok is it the "Configuring the Netty Pipeline" with the logbook example you mean? Looking at that now.
James Kleeh
@jameskleeh
yep
Josh Mattila
@spinfooser
Is anyone making Direct Invoke Lambda calls from within a lambda in a graal micronaut app? I'm running into an issue where the AWS SDK library uses a resource file in its own JAR that native-image has no idea about, and the automated resource-config.json generation fails to account for it. Is there a way to supplement/customize what is generated for the resource-config.json file? Relevant Related Issue: https://stackoverflow.com/questions/54931286/micronaut-serverless-application-using-dynamodb-and-graal-custom-runtime-throws
2 replies
Anand Jaisy
@anandjaisy
Is there any example of CQRS pattern with micronaut implementation
Darren Bell
@KangoV

I'm trying to write a unit test that disables the Kafka client via creating a replacement:

// Only instantiate when kafka.enabled is set to false
@Requires(property = "kafka.enabled", notEquals = StringUtils.TRUE, defaultValue = StringUtils.TRUE)
// Replace the @KafkaClient interface
@Replaces(EventClient.class)
public class EventClientFallback implements EventClient {

    @Override
    public void notify(String key, String string) {
        throw new UnsupportedOperationException();
    }

}

But, when I run it, I get: All possible Introduction advise exhausted and no implementation found for method

Any ideas?
The EventClientFT which uses Kafka completes successfully. I would just like to disable Kafka when only testing the external REST API that does not rely on the messaging parts.
Anand Jaisy
@anandjaisy
Is there any implementation of Axion with micronaut for CQRS ?
Darren Bell
@KangoV
It's a slow Saturday :)
Hantsy Bai
@hantsy
Hi , I tried to use R2dbcOperations.withConnection to do clean up work for database, but the following codes does not work as expected.

    override fun beforeEach(testCase: TestCase) {
        val sql = "delete from posts";

        val latch = CountDownLatch(1)
        Mono
            .from(
                this.template.withConnection { conn: Connection ->
                    Mono.from(conn.beginTransaction())
                        .flatMap { Mono.from(conn.createStatement(sql).execute()) }
                        .flatMap { Mono.from(it.rowsUpdated) }
                        .log()
                        .doOnSuccess { Mono.from(conn.commitTransaction()).subscribe() }
                        .doOnError { Mono.from(conn.rollbackTransaction()).subscribe() }
                }
            )
            .log()
            .doOnTerminate { latch.countDown() }
            .subscribe(
                { data -> log.debug("deleted rows: $data ") },
                { error -> log.error("error of cleaning posts: $error") },
                { log.info("done") }
            )

        latch.await(5000, TimeUnit.MILLISECONDS)
    }
Alex
@ahimik

Hi everyone,
just wondering if it is an expected behavior or not.
I've got a simple HttpClient with basic authentication managed within the filter:

@BasicAuth
@Context
public class BasicAuthFilter implements HttpClientFilter {

    @Override
    public Publisher<? extends HttpResponse<?>> doFilter(MutableHttpRequest<?> request,
                                                         ClientFilterChain chain) {
        request.basicAuth(...);
        return chain.proceed(request);
    }

}

when I put @Retryable on a method the subsequent requests get broken when error occurs because Authorization header gets duplicated on each subsequent request:

09:38:44.045 [default-nioEventLoopGroup-1-12] TRACE i.m.h.client.netty.DefaultHttpClient - Authorization: Basic YWRtaW46YWRtaWETTTWTY=
09:38:44.045 [default-nioEventLoopGroup-1-12] TRACE i.m.h.client.netty.DefaultHttpClient - Authorization: Basic YWRtaW46YWRtaWETTTWTY=
09:38:44.045 [default-nioEventLoopGroup-1-12] TRACE i.m.h.client.netty.DefaultHttpClient - Authorization: Basic YWRtaW46YWRtaWETTTWTY=

As I understand the request goes through the filter on each retry again and again and Authorization header gets duplicated again and again.
Is it desired behavior that call to request.basicAuth(...) doesn't replace the existing authentication?

James Kleeh
@jameskleeh
I’d have to read the spec to be sure but I agree
Anand Jaisy
@anandjaisy
sakenzhuma
@sakenzhuma
Hello, how to configure jdbi to wotk with mysql?