sebastiandaschner news
Hi and welcome to another newsletter!
As the saying goes: I hope this email finds you well — and I really mean it. I wished the year would have continued as quiet and peaceful as it started for a lot of us, but here we are and we have to make the best of it. I’ve stopped putting out content for a few weeks, I didn’t quite feel like it, as the situation in Ukraine touched and troubled me a lot, personally.
Yet, I believe that no matter the situation the best is to focus on a positive thing that we can do, and if I can help someone else by creating hopefully helpful or inspiring content on IT, then that’s the way to go.
What’s new
Creating and using a Telegram Bot with Java
I’ve recorded a video on how to create and use a Telegram Bot from within your Java application. The back story for that is that I regularly run some automated jobs on my server or some machine that just automate some work for me, and besides emails a nice way for more urgent information is to receive notifications on ones phone.
In the video, I’m showing how to quickly create your own bot and how to use the Telegram HTTP API from Java. I’m using Quarkus, but really any technology that supports HTTP is suitable.
You can watch the video, the code, and more information here
Quarkus Command Mode
A great way to kick start standalone Java applications — the kind you’d want to run as a standalone job on your server, for example, is to use the Quarkus Command Mode. The big benefit is that you’re able to use the Enterprise Java programming model using dependency injections and it’s other features, as well as Quarkus' development mode.
To get started, you can create the following class in a Quarkus Maven project, and then add some more beans.
import io.quarkus.runtime.Quarkus;
import io.quarkus.runtime.QuarkusApplication;
import io.quarkus.runtime.annotations.QuarkusMain;
@QuarkusMain
public class Main implements QuarkusApplication {
@Override
public int run(String... args) throws Exception {
Quarkus.waitForExit();
return 0;
}
}
For a full example, you can watch the following video
Quarkus Test Mode
If you use Quarkus' development mode and, like me, always activate the continuous testing and test output as the first thing, you can save yourself two keystrokes by putting this into the application.properties
:
quarkus.test.continuous-testing=enabled quarkus.test.display-test-output=true
This will make sure your tests run continuously and by hitting R
you can quickly re-execute your tests.
Thanks a lot for reading and see you next time!
Did you like the content? You can subscribe to the newsletter for free: