Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Last active September 16, 2019 21:15
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/a47834f9c6dc4f85fe2de58084ac0246 to your computer and use it in GitHub Desktop.
Save AdamBien/a47834f9c6dc4f85fe2de58084ac0246 to your computer and use it in GitHub Desktop.
66thAirhacksQ&A.md

Ask questions and see you at September, 2nd, 6.PM. CET: http://www.ustream.tv/channel/adambien

Also checkout recent episode:

65th airhacks.tv

Please keep the questions Java EE-stic. Means: as short and as concise as only possible. Feel free to ask several, shorter questions.

@thatsIch
Copy link

Hi Adam,

we have a business constraint that a value should not drop below 0. The value is calculated on the fly based on a set of entries. We offer a JAX-RS endpoint to allow adding entries but if the account drops below 0. Imagine just a basic bank account where you have 50€ and you can book as long you have enough funds on your account.

Some clients started to replay their POST requests and dropped below 0€ because of race conditions,
because when the request was posted they had enough funds. How can you prevent that? Obviously, we told the clients to stop that, but we want to protect the business constraints on our side, too.

Love from Essen, DE

@dempile
Copy link

dempile commented Aug 20, 2019

Hi Adam,
In the comunication between two microservices , you said that we should copy paste the entity in the two, how would you implement the outbox transactional pattern in order to notify other microservices that data has changed.
I know that you dont like using third party libraries but what do you think of the combinaison of Debezium and Kafka. Is there any alternatives?
Thanks

@m7zander
Copy link

Hi Adam,

in your screen cast here you get a browser warning about using "document.write" when using a web component with lit-html. How do you handle (or ignore) this warning in real projects?

Thanks
Markus

@Tunjidir
Copy link

Hi Adam,

we have a business constraint that a value should not drop below 0. The value is calculated on the fly based on a set of entries. We offer a JAX-RS endpoint to allow adding entries but if the account drops below 0. Imagine just a basic bank account where you have 50€ and you can book as long you have enough funds on your account.

Some clients started to replay their POST requests and dropped below 0€ because of race conditions,
because when the request was posted they had enough funds. How can you prevent that? Obviously, we told the clients to stop that, but we want to protect the business constraints on our side, too.

Love from Essen, DE

Hi thatslch, you should try using a constraintvalidator, with a single annotation and a class that implements that ContraintValidator. you can validate the request on the fly when it's been passed as a POST request body.

@sgulci
Copy link

sgulci commented Aug 21, 2019

Hi Adam,

Are you using minishift or okd origin for your local test? which are you recommend

thanks
Sahin

@Tunjidir
Copy link

Tunjidir commented Aug 22, 2019

HI adam in this blog post you wrote sending an inputstream to jaxrs you showed how to send an inputstream to jaxrs resource, assuming i was sending this from the front end as a POST request using javascript's fetch api. how do i parse the image as an input stream?

@Tunjidir
Copy link

Hi adam, what is Odata and is the apache library olingo an implementation?. do you think it's useful in projects or it's an absolute overkill?

@FreifeldRoyi
Copy link

FreifeldRoyi commented Aug 24, 2019

Hi Adam,
What is the best alternative to injecting ManagedExecutorService, in Microprofile? In Quarkus?
Also, when injecting MES, some default queue and pool size is given by the application server, while now (I think) I have to configure everything by myself. How would you suggest doing that ? and how to determine the values?

Thank you !

@altuga
Copy link

altuga commented Aug 25, 2019

Hello Adam

I'm reading "The Effective Java" book by Joshua Bloch and in that book author advice to use immutable classes.
For example :

public **final** class Complex {
    private **final** double re;
    private **final** double im;

    private Complex(double re, double im) {
        this.re = re;
        this.im = im;
    }

    public static Complex valueOf(double re, double im) {
        return **new Complex(re, im);**
    }

    public static Complex valueOfPolar(double r, double theta) {
        return **new Complex(r * Math.cos(theta), r * Math.sin(theta));**
    }

    // ...
} 

What is your advice about combining Effective Java 's immutable approach and Java EE ?

Regards from Java User Group Istanbul

@Tunjidir
Copy link

Hi Adam,

What should a JavaEE developer know in 2019?
Tips for JavaEE developer interviews?
Thanks

JAX-RS, CDI, EJB's & JPA and you're pretty much good to go.

@t-shaguy
Copy link

t-shaguy commented Sep 1, 2019

Hi Adam,
Please are there limitations to forking code based on GPL3? I want to know the implications if I plan to go commercial with my own version

@dkrtic
Copy link

dkrtic commented Sep 1, 2019

Hi Adam,

can you explain or even better show us how you use jwtenizr for intergration tests in Jenkins.
Thanks!

@nkengasongatem
Copy link

Hi Adam,

Please how can I use an application server (e.g Payara) with docker to deploy a .ear ?

Thanks

@devflorence
Copy link

Hi Adam,

just to stop from boring you with technical questions.....a business related question :-)

Let's say that someone tomorrow want to start a small business for consultancy/development on Java/JakartaEE platform.

What's your vision about the billing model? Time-based (risk on client) or feature based (risk on provider)? And in this latter case do you have any suggestions about the most effective (pragmatic) way to deal with the issue of work estimates?

Thank you and I hope to come at airhacks in December...

Alessandro De Stasio

@AdamBien
Copy link
Author

AdamBien commented Sep 2, 2019

@t-shaguy
Copy link

t-shaguy commented Sep 2, 2019

Hi Adam,

Please do you advice developing a securities trading solution in PHP? I mean is PHP battle tested enough for this. I am trying to justify a move to java but its a battle convincing the business team. Please advice me on best ways to.

@fblan
Copy link

fblan commented Sep 16, 2019

Hi Adam,

we have a business constraint that a value should not drop below 0. The value is calculated on the fly based on a set of entries. We offer a JAX-RS endpoint to allow adding entries but if the account drops below 0. Imagine just a basic bank account where you have 50€ and you can book as long you have enough funds on your account.

Some clients started to replay their POST requests and dropped below 0€ because of race conditions,
because when the request was posted they had enough funds. How can you prevent that? Obviously, we told the clients to stop that, but we want to protect the business constraints on our side, too.

Love from Essen, DE

Hi Adam, do you think it is possible to use database to check race condition? a request looking like :

begin transaction
Query query = em.createQuery(
"UPDATE Account SET amount=amount-:removedAmount WHERE id=:id and amount>:removedAmount");
query.setParameter("id", accountid);
query.setParameter("removedAmount",105);
int updateCount = query.executeUpdate();
transaction commit
if(updateCount==1){
return 'success';
}

do you think this could work?

Thanx a lot for your podcast :)

Fred

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