Giter Club home page Giter Club logo

abp.eventbus.boxes.dtm's Issues

How to properly integrate DTM in abp application

Hi,

Exception:

2023-05-19 14:28:58.594 +02:00 [ERR] Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.get_IsCompleted()
   at EasyAbp.Abp.EventBus.Boxes.Dtm.AbpDtmgRPCClient.DtmGrpcCall(TransBase transBase, String operation)
   at Dtmgrpc.MsgGrpc.Prepare(String queryPrepared, CancellationToken cancellationToken)
   at EasyAbp.Abp.EventBus.Boxes.Dtm.GrpcDtmMessageManager.PrepareTransMessagesAsync(DtmOutboxEventBag eventBag, CancellationToken cancellationToken)
   at EasyAbp.Abp.EventBus.Boxes.Dtm.GrpcDtmMessageManager.PrepareAndInsertBarriersAsync(DtmOutboxEventBag eventBag, CancellationToken cancellationToken)
   at EasyAbp.Abp.EventBus.Distributed.Dtm.DtmUnitOfWork.CommitTransactionsAsync()
   at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken)
   at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)

I have a newly generated abp application (v7.2.2) (tiered, mvc, ef core - postgres).

Added configuration and code in HttpApi.Host (deployable) project.

appsettings.json

"RabbitMQ": {
    "Connections": {
      "Default": {
        "HostName": "localhost",
        "Port": "5672",
        "UserName": "guest",
        "Password": "guest"
      }
    },
    "EventBus": {
      "ClientName": "rabbit@dev-rabbit",
      "ExchangeName": "amq.direct"
    }
  },
  "DTM": {
    "ActionApiToken": "1q2w3e",
    "AppGrpcUrl": "http://localhost:54358",
    "DtmGrpcUrl": "http://localhost:36790"
  }

Additional code in xxxxHttpApiHostModule.

DependsOn:

typeof(AbpEventBusRabbitMqModule),
    typeof(AbpEventBusBoxesDtmGrpcModule),
    typeof(AbpEventBusBoxesDtmEntityFrameworkCoreModule)

Method ConfigureServices

Configure<AbpDistributedEventBusOptions>(options =>
        {
            options.Outboxes.Configure(config =>
            {
                config.UseDbContextWithDtmOutbox<AbpDtmApp1DbContext>();
            });

            options.Inboxes.Configure(config =>
            {
                config.UseDbContextWithDtmInbox<AbpDtmApp1DbContext>();
            });
        });

        // Use `AddDtmOutbox` and `AddDtmInbox` separately if you only need one of them.
        context.Services.AddDtmBoxes();

        context.Services.AddGrpc();
        context.Services.AddAbpDtmGrpc(options =>
        {
            options.ActionApiToken = "1q2w3e";  // DTM Server invokes app's action APIs with this token for authorization.
            options.AppGrpcUrl = "https://localhost:44336";  // Base URL for DTM Server to invoke the current app. Only HTTP now!
            options.DtmGrpcUrl = "http://127.0.0.1:36790";  // Base URL for the current app to invoke DTM Server.
        });

Method OnApplicationInitialization

app.UseConfiguredEndpoints(endpoints =>
        {
            endpoints.MapAbpDtmGrpcService();
        });

Connection to RabbitMQ works.
DTM is launched as .exe application and I can access GUI via localhost:36789

Thank you for helping.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.