Akka for Asynchronous processing? [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
My use case is there will be four microservices A,B,C and D. My input request to Microservice D will be generated based on the outputs from A,B and C.Since A,B,C are independent, Instead of synchronously calling A,B and C thereby blocking the thread and building the request for microservice 'D' after three calls, have planned to call it asynchronously.
Is Akka a good fit for this use case? or it is overkill.
I read that akka is a concurreny tool kit, since my application does not have concurrency concerns, still can i use akka just for asynchrous processing? or is it overkill?

Yes, it is definitely an overkill. If you don't want to block a thread when calling another service all you need is a non-blocking http client. Or even a blocking http client that works on a separate thread pool. Just use anything that returns you Future[ResponseFromService]. akka-http client is one of options. But not raw akka.

Related

Implementation approaches of event sourcing with microservices [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I'm currently wrapping my head around event sourcing and microservices, and so far, I can image the following approaches. Please correct me if I'm wrong. I'm also looking for other possible approaches.
Approach 1:
Each microservice is connected to a central Event Store. A Microservice A can publish events to the Event Store, other Microservcies subscribe to these events.
Approach 2:
Each microservice has local event store. A microservice A can directly send an event via a message broker to another microservice B.
Approach 3:
Each microservice has local event store. A microservice A can subscribe to an event store of another microservice B.
I suggest the first option. When dealing with any cross cutting concerns you might find it easier to have all your domain events in one place.
We're currently running in production an architecture based on approach 1 with roughly 20 services so far.

What is the best approach in java to call a C function running on another server? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
What is the best approach in java to call a C function running on another server? My application written in Java and running on an application server on server 'A' and I need to call a C function running on another server 'B' that doesn't have java installed.
Should we build a web service on server B to accept requests from my Web application on server A? or just call it remotely using RPC? and what is the performance of both?
First of all:
Just call it using RPC
There is no such thing as "just" when talking RPC. Unless you already have some CORBA or whatever solution in place, you will have to invest a serious amount of time to get this working.
Using a web service adds multiple layers of abstraction, which can affect latency. But of course, that is the more flexible solution.
I think it is fair (in 2018) to state: a reasonable architecture would provide some sort of (restful) HTTPS service on B. You should only look into other options if there are hard pressing reasons.

Sending a message between two Java components [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I have a question about messaging systems.
There are two Java applications - A and B. A works constantly and checks the resource. In some cases it need to notifiy B to start. It seems that there is no need to enlarge this messaging later: there will be always two components.
What is the most elegant way to implement it? JMS? Spring Integration somehow?
Another options?
Do I understand correctly that in any case B needs to busily wait?
IMO it is better to use Apache active mq . It is open source and supports JMS 1.1 and J2EE 1.4.
As you are using two applications.You can add the message from A to Active MQ Queue and B would be continuously checking the message queue. So once B receives a message you could perform the operations that you would require.

Best way to transmit data between two applications [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
What is the best way to transmit data between two (Java) applications running on the same machine? One obvious idea would be to use standard Sockets but this doesn't feel right.
I've heard that most operating systems have a built-in system specifically for this task. How is it called and how does it work?
And is there any other good method to do something like that?
I think it depends on what you want to communicate between the applications and the size of your project. Some examples:
Sharing of state - use a database, files or similar
Messaging - use a socket. On top of a socket you have several technologies you can leverage, like HTTP/REST, but you can also create your own transport
There are also message applications you can leverage, like RabbitMQ

Best way of client server communication in Java [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am building an application where in the requirement is that, there is a main server, which will send signal to client server, based on this signal the client performs certain action and send back the response to the main server. Here there will be only one main server and can be multiple client servers. At a given time the main server can send multiple signal to multiple clients.
I am presently planning to do this using socket programming in Java using two ports. Do let me know the best way of achieving this? and also do we have any good existing API's that can be used?
Take a look at RMI: https://docs.oracle.com/javase/tutorial/rmi/ If you want something based on sockets/TCP/UDP/etc, writing something with Netty may be good solution -> http://netty.io/ (they have useful examples).
I would also recommend to consider plain Java Sockets if planned communication beetween server and clients is not comlex and you do not need all this stuff which is provided by libraries like Netty.

Categories