Skip to content

Commit

Permalink
Business interface as messaging gateway (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgafka authored Aug 20, 2023
1 parent cc4a489 commit 2df6f97
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
14 changes: 14 additions & 0 deletions packages/Ecotone/src/Messaging/Attribute/BusinessMethod.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace Ecotone\Messaging\Attribute;

use Attribute;
use Ecotone\Messaging\Handler\Gateway\GatewayProxyBuilder;

#[Attribute(Attribute::TARGET_METHOD)]
class BusinessMethod extends MessageGateway
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace App\Testing\Domain\ShoppingBasket;

use Ecotone\Messaging\Attribute\MessageGateway;
use Ecotone\Messaging\Attribute\BusinessMethod;
use Ecotone\Modelling\Attribute\Identifier;
use Ramsey\Uuid\UuidInterface;
interface ProductService
{
#[MessageGateway("product.getPrice")]
#[BusinessMethod("product.getPrice")]
public function getPrice(#[Identifier] UuidInterface $productId): int;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace App\Testing\Domain\ShoppingBasket;

use Ecotone\Messaging\Attribute\MessageGateway;
use Ecotone\Messaging\Attribute\BusinessMethod;
use Ecotone\Modelling\Attribute\Identifier;
use Ramsey\Uuid\UuidInterface;

interface UserService
{
#[MessageGateway("user.isVerified")]
#[BusinessMethod("user.isVerified")]
public function isUserVerified(#[Identifier] UuidInterface $userId): bool;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

use App\WorkingWithAggregateDirectly\Command\ChangePrice;
use App\WorkingWithAggregateDirectly\Command\RegisterProduct;
use Ecotone\Messaging\Attribute\MessageGateway;
use Ecotone\Messaging\Attribute\BusinessMethod;
use Ecotone\Modelling\Attribute\AggregateIdentifier;

/**
* Implementation will be auto-generated and this class will be available in your Dependency Container
*/
interface ProductService
{
#[MessageGateway(Product::PRODUCT_REGISTER_API)]
#[BusinessMethod(Product::PRODUCT_REGISTER_API)]
public function registerProduct(RegisterProduct $command): void;

#[MessageGateway(Product::PRODUCT_CHANGE_PRICE_API)]
#[BusinessMethod(Product::PRODUCT_CHANGE_PRICE_API)]
public function changePrice(ChangePrice $command): void;

#[MessageGateway(Product::PRODUCT_GET_PRICE_API)]
#[BusinessMethod(Product::PRODUCT_GET_PRICE_API)]
public function getPrice(#[AggregateIdentifier] $productId): float;
}

0 comments on commit 2df6f97

Please sign in to comment.