Open Closed

Localization via RabbitMQ #5294


User avatar
0
nguyenngoc.son created
  • ABP Framework version: v7.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace: From service A, we're sending one message to service B via RabbitMQ, however when service B proceed the message, it using default localizaion instead of language that currently use by user.
  • Steps to reproduce the issue:"
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    You can try:

    public abstract class EventDataWithCultureName
    {
        public class CultureName {get; set;}
    }
    
    public class MyEventData: EventDataWithCultureName
    {
        ......
    }
    
    await _distributedEventBus.PublishAsync(
        new MyEventData
        {
            CultureName = CultureInfo.CurrentCulture.Name
        }
    );
    
    
    public class MyHandler: IDistributedEventHandler<MyEventData>, ITransientDependency
    {
        public async Task HandleEventAsync(MyEventData eventData)
        {
            using (CultureHelper.Use(CultureInfo.GetCultureInfo(eventData.CultureName)))
            {
               ....
            }
        }
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.