Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: IntegrationEventBus supports isolation #604

Merged
merged 8 commits into from
May 10, 2023
Merged

fix: IntegrationEventBus supports isolation #604

merged 8 commits into from
May 10, 2023

Conversation

zhenlei520
Copy link
Contributor

Description

IntegrationEventBus supports isolation

If your project supports isolation, you need to add when using integration events:

Modify Program.cs

app.UseCloudEvents();

//It must be after UseCloudEvents
app.UseMasaCloudEvents();

app.UseEndpoints(endpoints =>
{
    endpoints.MapSubscribeHandler();
});

Issue reference

issues-550

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@zhenlei520 zhenlei520 marked this pull request as ready for review May 8, 2023 10:42
@zhenlei520
Copy link
Contributor Author

zhenlei520 commented May 8, 2023

When using Isolation, you need to assign a value to DaprAppId, and the priority of DaprAppId is:

  1. Specify sidecar appid when using Dapr

    var services = new ServiceCollection();
    services.AddIntegrationEventBus<CustomIntegrationEventLogService>(opt =>
    {
        opt.UseDapr("pubsub", "{Replace-Your-DaprAppId}");
    });
  2. Configure the environment variable dapr-appid, Take launchSettings.json as an example:

    {
        "profiles":{
            "WebApplication":{
                "commandName":"Project",
                "dotnetRunMessages":true,
                "launchBrowser":true,
                "launchUrl":"swagger",
                "applicationUrl":"https://localhost:7172;http://localhost:5079",
                "environmentVariables":{
                    "ASPNETCORE_ENVIRONMENT":"Development",
                    "DAPR_APPID":"{Replace-Your-DaprAppId}"
                }
            }
        }
    }
  3. Use global AppId

    services.Configure<MasaAppConfigureOptions>(options =>
    {
        options.AppId = "{Replace-Your-ApplicationId}";
    });

    When using MasaConfiguration, it takes the value from the node AppId by default

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

89.9% 89.9% Coverage
0.0% 0.0% Duplication

@doddgu doddgu merged commit 970d4de into main May 10, 2023
@doddgu doddgu deleted the fix/issues-550 branch May 10, 2023 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publish Integration Events Errors in Isolation
2 participants