Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Created April 6, 2021 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamBien/165d26f83101c599fda4b8b46fc54828 to your computer and use it in GitHub Desktop.
Save AdamBien/165d26f83101c599fda4b8b46fc54828 to your computer and use it in GitHub Desktop.
86thAirhacksQ&A.md

Ask questions and see you at May, 3rd, 8.PM. CET: https://vimeo.com/event/154379

Also checkout recent episode:

85th 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

@thehpi
Copy link

thehpi commented Apr 16, 2021

I have an JPA Entity with bean validation on it so it produces a ValidationConstraintException when something is wrong.
I have an EJB which does the entity handling and a REST api which calls the EJB.
When there is a validation issue I get the ValidationConstraintException wrapped in a RollbackException wrapped in a EJBException.

So I want to prevent wrapping. It can be done using the @applicationexception on my own exceptions but in the example above I cannot apply the annotation. I can also use the ejb-jar.xml to set the and I tried but this also seems to work only on my own exceptions which are defined in the EJB.

Is there a way to tell the system to not wrap the ValidationConstraintException?

I'm using payara btw

@thehpi
Copy link

thehpi commented Apr 26, 2021

I'm wondering if this construction on an EJB method makes sense.

@Asynchronous
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
pubic void mymethod() {
  ..
}

Does @asynchronous already imply a new transaction?

@farnetto
Copy link

What do you think of gradle? Why do you only use maven?

@thehpi
Copy link

thehpi commented Apr 30, 2021

Is it possible to create a JTA transaction in a servlet and pass that on somehow to an EJB so the EJB will use the transaction created in the servlet? Could you show how to do that?

@dabkhazi
Copy link

Hi Adam. My question is about web development. In workshops, you use all the most modern features of javascript and css. How do you solve the problem if the user's web browser does not support all modern features?

@glitchcube
Copy link

Hi Adam!

Could you make a video showing a simple pipeline for deploying a front end and backend app to a test environment and then production?
Perhaps this could be video you could include in one of your online video courses:)

@dabkhazi
Copy link

dabkhazi commented Apr 30, 2021

There is also a question about configuring the frontend application. Where to save, for example, url's of rest services? How do you organize front-end application configuration? In additional tutorial on migrating from redax to redax-toolkit, you used a file init.js to set an environment variable. I think it is possible to place other tuning parameters in the same place, right?

@dabkhazi
Copy link

What web server do you use for front-end applications? Please recommend. During development you use the browser-sync, but in production?

@gunnarpruefer
Copy link

Hello Adam,
first of all: great show, really enjoy your pragmatic view on things and the shared insights.

  1. for your "First Monday of the Month Bug" disclosed in airhacks #84: The JDK got your back and can help you out on this one:
    var firstMondayOfTheMonth = now.with(TemporalAdjusters.firstInMonth(DayOfWeek.MONDAY)))
    Even saves you a line of code and is always right.
    Btw, it is not really a "now" if the var is assigned a now().plusMonths(1) ... ;- )

  2. In airhacks #81 (yes, rather late feedback) frequent questioneer @thehpi was asking in the very last question of that show

I want to be able to configure for a user how many request per second he can fire onto my server

and you suggested MP's Bulkhead. I understood the question slightly different and thought he might be looking for a "per user" mechanism, not how many concurrent requests across all users (?). How would you implement this? Via Interceptor involving i.e. bucket4j?

  1. In an Java EE application with JSF I would like to replicate the HTTP sessions of a larger number of (containerized) instances, i.e. via shared Redis. How would you implement this? Any experience on the limitations? Any concerns running the application servers in standalone mode rather than cluster mode?

Thanks in advance. Greetings from and to Munich.

@alibttb
Copy link

alibttb commented May 1, 2021

Hello Adam,

What is your view on the software development process? do you use UML? are use-cases and sequence diagrams still relevant? what are the required documents for a good software development practice?

thank you.

@gunnarpruefer
Copy link

Hello Adam,
one more topic: What would be your preferred way to deploy an application as in "webcomponents-with-redux.training"? Would you deploy frontend and backend seperately? If so, how would you serve the frontend? Just serve it from a plain nginx Docker container?

Given there is a only a small number of developers who are all fullstack and FE + BE don't get developed seperately, how about a single deployment unit, rolling-up the FE into the static assets/resources of the Quarkus "backend"?
Curious about your suggestions.

@AdamBien
Copy link
Author

AdamBien commented May 2, 2021

Question from the screencast "Testing ServiceWorkers on iPhone and Quarkus" / https://youtu.be/ljSQXfc-GkA

"Hey Adam, I don't know if you read your comment or not but how about a guide about the following:
When building a JakartaEE App you have to define a jaxrs resources path using @ApplicationPath but using Quarkus you don't need this.
It's a topic worth covering because when you do @ApplicationPath("/") the path interference with the WebApp folder. It's an interesting use case for e.g. Server Side Rendered Apps using JaxRs endpoints as "pages"

@glitchcube
Copy link

Hi Adam!

Do you have any recommendations for programming books? Preferably geared towards architecture, design principles, tips and tricks.
I was also considering buying one of your books, but I see they are from 2012. Would you say the content is still relevant? :)

https://www.amazon.com/Real-World-Java-Patterns-Rethinking-Practices-ebook/dp/B009ZQ9I62/

Best regards Frank

@semisft
Copy link

semisft commented May 3, 2021

Hi Adam,
What is the simplest JavaEE'stic way to build a real-time bidding system?
A stream of prices flow and you should act for each price in order in a certain time frame.
Before going to a Message Queue system, can we solve with Java concurrency classes?
Best regards,
Ahmet

@thehpi
Copy link

thehpi commented May 3, 2021

I use the @schedule to schedule jobs which is very convenient.
Every now and then however the job fails which is accepted but when it fails twice it shuts down completely.

Is there a way to disable this behaviour or configure it to a higher value.

I know the solution would be to catch the exception and let it not fail but I don't have control over this class.

@WassimAkachi
Copy link

Hi Adam,

in JavaScript:

  1. do you often use pre defined (DTO)-classes like
// in file: car.js
export default class Car {
  constructor(name, year) {
    this.name = name;
    this.year = year;
  }
}


// in some other js-file

import './car.js'

// some logic

const car = Car("Hey Car", 2021);

// store in Redux
dispatch({
"action": "CAR_CREATED",
"payload":  car
});
  1. or do you prefer to build objects on the flight?

When would you prefer one over the other? Which approach do you suggest?

Thank you,
Wassim

@WassimAkachi
Copy link

Hi Adam,

when one js-module (e.g. common-module.js) is imported in multiple different js-modules, is the code inside the common-module.js executed multiple times? Or is the module like static-code block in Java?

Thank you,
Wassim

@dabkhazi
Copy link

dabkhazi commented May 3, 2021

I use the @schedule to schedule jobs which is very convenient.
Every now and then however the job fails which is accepted but when it fails twice it shuts down completely.

Is there a way to disable this behaviour or configure it to a higher value.

I know the solution would be to catch the exception and let it not fail but I don't have control over this class.

I also ran into a similar problem in openliberty.

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