Skip to content

Deduplication clean up fails in multi tenant connection setup with no default #667

@tandev

Description

@tandev

Ecotone version(s) affected: 1.312.0

Description

Having a Setup with MultiTenancy and multiple connections without default connection leads to exception on running the
ecotone:deduplication:remove-expired-messages command

Error thrown while running command "ecotone:deduplication:remove-expired-messages". 
Message: "Lack of context about tenant in Message Headers. Please add `tenantId` header metadata to your message." 
["exception" => Ecotone\Messaging\Support\InvalidArgumentException { …},"command" => "ecotone:deduplication:remove-expired-messages","message" => "Lack of context about tenant in Message Headers. Please add `tenantId` header metadata to your message."] ["trace_id" => "3dd4a6b4-70e3-432c-8ac4-6f3f533a5b7d","transaction_id" => "42ee5498-48c0-4b5e-85dd-5538e0c20cb8"]

How to reproduce

  • MultiTenantConfiguration with connection mapping setup
  • Run ecotone:deduplication:remove-expired-messages command

Possible Solution
Might have to iterate through all connections, although a tenant specific deduplciation table might not necessarily make sense

Context

In HeaderBasedMultiTenantConnectionFactory.php line 105:
                                                                                                           
  [Ecotone\Messaging\Support\InvalidArgumentException]                                                     
  Lack of context about tenant in Message Headers. Please add `tenantId` header metadata to your message.  
                                                                                                           
Exception trace:
 at vendor/ecotone/dbal/src/MultiTenant/HeaderBasedMultiTenantConnectionFactory.php:105
 Ecotone\Dbal\MultiTenant\HeaderBasedMultiTenantConnectionFactory->getConnectionFactory() at vendor/ecotone/dbal/src/MultiTenant/HeaderBasedMultiTenantConnectionFactory.php:196
 Ecotone\Dbal\MultiTenant\HeaderBasedMultiTenantConnectionFactory->createContext() at vendor/ecotone/dbal/src/Deduplication/DeduplicationInterceptor.php:175
 Ecotone\Dbal\Deduplication\DeduplicationInterceptor->getConnection() at vendor/ecotone/dbal/src/Deduplication/DeduplicationInterceptor.php:167
 Ecotone\Dbal\Deduplication\DeduplicationInterceptor->createDataBaseTable() at vendor/ecotone/dbal/src/Deduplication/DeduplicationInterceptor.php:122
 Ecotone\Dbal\Deduplication\DeduplicationInterceptor->removeExpiredMessages() at vendor/ecotone/ecotone/src/Messaging/Handler/Processor/MethodInvoker/MethodInvoker.php:40

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions