Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
100thAirhacksQ&A.md

Ask questions and see you at July, 4th, 8.PM. CET: youtube.com/c/bienadam

Also checkout recent episode:

99th airhacks.tv

Please keep the questions Jakarta EE-stic. Means: as short and as concise as only possible. Feel free to ask several, shorter questions. Upcoming airhacks.tv events are also going to be announced at meetup.com/airhacks

@jarryDk
Copy link

jarryDk commented Jun 8, 2022

Dear @AdamBien

I have tried the lambda-java17-layer to enable jdk17 in a CDK deployment and like to hear you idea on how to reuse the Java17Layer across multiple CDK deployments.

I do not like the idea of uploading java17layer.zip in every CDK deployment.

public class Jdk17Layer {
	Construct scope;
	public Jdk17Layer(Construct scope) {
		this.scope = scope;
	}
	public LayerVersion getLayer() {
		LayerVersion java17layer = new LayerVersion(scope, "Java17Layer", LayerVersionProps.builder()
		        .layerVersionName("Java17Layer")
		        .description("Java 17")
		        .compatibleRuntimes(Arrays.asList(Runtime.PROVIDED_AL2))
		        .code(Code.fromAsset("java17layer.zip"))
		        .build());
		return java17layer;
	}
}
public class QuarkusLambdaJdk17 extends Construct {
	static Map<String, String> configuration = Map.of("message", "hello, quarkus as AWS Lambda");
	static String lambdaHandler = "io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest";
	static int memory = 1024; // ~0.5 vCPU
	static int timeout = 10;
	IFunction function;
	public QuarkusLambdaJdk17(Construct scope, String functionName) {
		super(scope, "QuarkusLambda");
		this.function = createFunction(scope,functionName, lambdaHandler, configuration, memory, timeout);
	}
	IFunction createFunction(Construct scope, String functionName, String functionHandler, Map<String, String> configuration, int memory,
			int timeout) {
		Jdk17Layer java17layer = new Jdk17Layer(scope);
		return Function.Builder.create(this, functionName) //
				.runtime(Runtime.PROVIDED_AL2) //
				.layers(singletonList(java17layer.getLayer())) //
				.code(Code.fromAsset("../lambda/target/function.zip")) //
				.handler(functionHandler) //
				.memorySize(memory) //
				.functionName(functionName) //
				.environment(configuration) //				
				.timeout(Duration.seconds(timeout)) //
				.build();
	}
	public IFunction getFunction() {
		return this.function;
	}
}

@jefrog1844
Copy link

jefrog1844 commented Jun 11, 2022

Hi Adam. The 99th meeting you remarked how most all the questions were based on cloud technology. So I'll ask a question that not cloud related. -:)

I am using Quarkus to build a backend jax-rs application that accesses a Postgresql database. The jax-rs is accessed via a web client.

Could you explain some pro and con of the following deployments:

  1. Deploy with Docker compose (jax-rs, db, web client)
  2. Deploy as Executable jar (web client would be included in resources/META-INF/resources)
  3. Deploy as native executable (web client would be included in resources/META-INF/resources)

@Joofthan
Copy link

Joofthan commented Jun 17, 2022

Hi Adam, What is your opinion on database schema migration in plain Jakarta EE? How do you add tables and change columns. Liquibase, Flyway or manuel scripts? Should Liquibase(6,6MB) be included in the war file?

@AdamBien
Copy link
Author

AdamBien commented Jun 17, 2022

@AdamBien Hey! Can you pleeeeeeeeeeease help me with this question? Since Jakarta EE is a set of specifications, is it true that an application built using only Jakarta APIs, rather than Spring for instance, is better for cloud as it allows me to deploy only my business logic?

— Douglas (@Douglas61121623) June 17, 2022

@douglas444
Copy link

douglas444 commented Jun 20, 2022

Hi, Adam.

Feel free to ask several, shorter questions.

Ok, so here I go. And I'm sorry if there's a lot of misconceptions on my questions though. I'm new to Jakarta.

First question:

In a context where the deployment is layered and an application server is used, is there any significant advantage in having the application built using only Jakarta APIs rather than dependencies that are bundled in the artificat (like Spring's ones)?

@douglas444
Copy link

douglas444 commented Jun 20, 2022

Considering that the answer for my previous question was positive (or at least a "maybe"):

How using Quarkus instead of an application server would impact this possible advantage? I mean, considering that Quarkus puts all required runtime dependencies in a lib-folder which you can put into a Docker-Layer.

@douglas444
Copy link

douglas444 commented Jun 20, 2022

Spring Native is said to provide key advantages, like instant startup, instant peak performance, and reduced memory consumption. Is there a equivalent solution for applications built using Jakarta EE only?

@douglas444
Copy link

douglas444 commented Jun 20, 2022

If I use Payara as my application server but I want to use Hibernate instead of eclipselink, will I have to deploy Hibernate together with my application?

@douglas444
Copy link

douglas444 commented Jun 20, 2022

How does Quarkus provides to the application the dependencies from the lib folder? In terms of efficiency, how does this Quarkus strategy for providing dependencies compares to the one used by application servers to provide spec's implementations to the application?

@douglas444
Copy link

douglas444 commented Jun 20, 2022

Which application server do you recommend if I want to use Hibernate (I'm not intending to use Hibernate specific features though. I just prefer its logging)?

@autohandle
Copy link

autohandle commented Jun 22, 2022

100? whoa!!
congradulations!
and, of course, a shout-out to kinga

@pglizniewicz
Copy link

pglizniewicz commented Jun 27, 2022

Do you have any recommendations or "rules of thumb" on where to check roles/privileges declaratively? Basically, where would you use annotations like Spring @Secured: at the Controller (endpoint) level or at the business logic/"service" level? If "it depends", then what are the questions I should ask, before settling for one of these approaches?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment