The approach in the link seems promising, we will get it a try.
So switching from ID to GUID is out of question at this point in our application development process.
InsertAsync() is returning me the ID. So I do not think I need to handle HandleEventAsync() to get the ID.
If the above statements are correct. then PublishAsync() seems to be the only option for me. And if that is the way to go, then is it enough to remove just this code to stop any default Kafka Publish or do you suggest a different method?
Configure<AbpDistributedEntityEventOptions>(options => { //Enable for Location entity options.AutoEventSelectors.Add<X>(); options.EtoMappings.Add<X, Y>(); });
Hi,
So are you manually using the Kafka API to post messages instead of EventBus?
Sorry, I was too short in my context. We have enabled Kafka using AbpEventBusKafkaModule
and *Eto
s and use the SaveChanges()
to trigger the messages. We do not (want to) use _distributedEventBus.PublishAsync(...)
to explicitly fire the message.
I may want to publish the message only if say the status = "ACTIVE" or IsExpired = false
Can you explain in detail? thanks.
So, in the implementation so far, when a new entity is created a message is published immediately. But maybe I do not want the message published because an entity property IsActive = false
. Later sometime, IsActive = true
will happen. That time the message should be published. It doesn't matter to me if the publish of the entity happens using UpdatedEvent or CreatedEvent.
Basically, I am looking for a mechanism to filter which messages should be posted.
Well, I cannot assign the ID manually in the EF (SQL Server) world, because it is being generated in the database by the identity column during insert. You may notice in the message "Id"=0
.
Doesn't ABP framework have any mechanism for database generated int
identity-column entities?
Provide us with the following info:
I have enabled ABP framework to post message to Kafka using the builtin mechanism (not PublishAsync()
). The message gets posted correctly. But sometimes I may want to publish the message only if say the status = "ACTIVE"
or IsExpired = false
. Is there any way like overriding a class method or dependency injection that I can introduce this check in the publish pipeline which will publish the message only if certain conditions are met?
I know PublishAsync()
can achieve it for me, but then I will end up writing the PublishAsync()
for about 95% of the entities just because I want to send the message only when status = "ACTIVE"
.
Let me know what additional information do you need ?
Provide us with the following info:
I have enabled ABP framework to post message to Kafka using the builtin mechanism (not PublishAsync()
). The message gets posted correctly. But for the CREATED event, the ID = 0. I expected the newly assigned ID to be available in the message. The newly assigned application is available to the code after CreateAsync()
call in the AppService. I expected this ID to be available in the message also. Am I missing any configuration?
Example:
Let me know what additional information do you need ?