Kind of type of @ID

Hello Guys, I am developing payment system and then per day we can get 1million of transactions, need to know well if is possible to use Long type of @Id because I am using uuid [String]. Anyone can help me how I can find a good type of @Id. I am using Spring boot 3.1.4, axon-framework 4.8

Other question. I am developing microservices with axon-framework and then need to call one or more microservices in one but I don’t know the communication of microservice I will use. Anyone can help me

Hi King,

The id should have a prober to string method. I don’t know why you would want an Long, instead of an UUID? As the ‘space’ of an UUID is the Long squared, so much larger. Are you afraid you might get a collision? There is a wiki that might put that at rest.

I’m not sure about your second question. Typically communication in an Axon application goes via messages. So if you want to change something you send a command, if you need some state, you send a query. So I assume you mean communication with a non Axon microservice? Which would typically mean some rest call where you need some service discovery?

Thanks, need to know well between uuid and long which one has a large records and is suitable for @Id because I will have more than 10millions of users and then per day, I will get more than 2millions of transactions. other question, I am looking feign client for calling microservices with CRUD operations in microservices but I don’t know well in axon-framework how I can call a microservices in one by doing crud operations. for example microservice A call microservice B,C in A and A can send post, put delete by using http onto B and C and then doing all operations need in A,B,C. Need Synchronous HTTP communication

I’m not sure why you need to send them via HTTP, instead of routed via messages with Axon Server. There are many ways to send HTTP calls with Java, which is not related to Axon Framework.

I am new in microservice but help me how I can use the great way and then how I ca do it easily because I am using axon framework and axon server.

Assuming you have control over the microservices, it’s best to make use of messages. So for changing data, a command message. While typically a command handler would create an event. It’s fine to store something in a database, or send an email. Basically you can do whatever you want.

If it’s an event sourced aggregate, you do need the apply. If not, you might still publish an event, so other microservices can react to it.

If you need to know information from another microservice, use a query message. You can either use a point-to-point query, only getting an answer from one instance, or use scatter-gatter, and combine answers from multiple applications having different application id’s, but implementing the same question handler. You can even have streaming or subscription queries, which keep an connection open to the other microservice.

Thanks a lot Sir, if is possible can you send me some resource or links? should be better for me, I am developing right now more than 30 microservices but my challenge is to make a good communication between microservices such as reading data from another microservice, modifying and creating or deleting some records to another microservices. need synchronous and asynchronous communications [resource, links or documents]

Maybe this helps. It’s a script to devide an Axon Application into multiple micro services. Please note that having different microservices not necessarily means you need multiple repositories.

You can use spring profiles to only enable parts of an application at runtime. This makes it easier to develop, as locally you can run just one instance with all profiles enabled. It’s also possible to have multiple modules, so you can easily share the messages.

Typically Commands are synchronous, where you could await the response. And events are typically used for communicating asynchronous, when a streaming event processor is used. Command messages have an intent te change something, Event messages are about something which has happened.

Hello Gerard,
I was trying to do what you told me by sharing data without discovery server but I have a problem by sharing data via core-api and others microservices, all them excluding core-api. I use your guideline you sent but failed, core-api can’t call in other microservice when I import inside

I don’t understand what the problem is. Do you have an example?