-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Simplify aggregate module
- Loading branch information
Showing
72 changed files
with
1,645 additions
and
2,308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/Ecotone/src/Messaging/Handler/Router/HeaderExistsRouter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Ecotone\Messaging\Handler\Router; | ||
|
||
use Ecotone\Messaging\Config\Container\DefinedObject; | ||
use Ecotone\Messaging\Config\Container\Definition; | ||
use Ecotone\Messaging\Message; | ||
|
||
/** | ||
* Class HeaderValueRouter | ||
* @package Ecotone\Messaging\Handler\Router | ||
* @author Dariusz Gafka <[email protected]> | ||
* @internal | ||
*/ | ||
/** | ||
* licence Apache-2.0 | ||
*/ | ||
final class HeaderExistsRouter implements RouteSelector, DefinedObject | ||
{ | ||
|
||
private function __construct(private string $headerName, private string $routeToChannel, private string $fallbackRoute) | ||
{ | ||
} | ||
|
||
public static function create(string $headerName, string $routeToChannel, string $fallbackRoute): self | ||
{ | ||
return new self($headerName, $routeToChannel, $fallbackRoute); | ||
} | ||
|
||
/** | ||
* @param Message $message | ||
* @return array | ||
*/ | ||
public function route(Message $message): array | ||
{ | ||
return $message->getHeaders()->containsKey($this->headerName) | ||
? [$this->routeToChannel] | ||
: [$this->fallbackRoute]; | ||
} | ||
|
||
public function getDefinition(): Definition | ||
{ | ||
return new Definition(self::class, [ | ||
$this->headerName, | ||
$this->routeToChannel, | ||
$this->fallbackRoute | ||
], 'create'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/Ecotone/src/Messaging/Handler/Transformer/TransformerProcessorBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ecotone\Messaging\Handler\Transformer; | ||
|
||
use Ecotone\Messaging\Config\Container\CompilableBuilder; | ||
use Ecotone\Messaging\Config\Container\Definition; | ||
use Ecotone\Messaging\Config\Container\MessagingContainerBuilder; | ||
use Ecotone\Messaging\Config\Container\Reference; | ||
|
||
/** | ||
* licence Apache-2.0 | ||
*/ | ||
final class TransformerProcessorBuilder implements CompilableBuilder | ||
{ | ||
private function __construct(private TransformerBuilder $transformerBuilder) | ||
{ | ||
|
||
} | ||
|
||
public static function create(TransformerBuilder $transformerBuilder): self | ||
{ | ||
return new self($transformerBuilder); | ||
} | ||
|
||
public function compile(MessagingContainerBuilder $builder): Definition|Reference | ||
{ | ||
return $this->transformerBuilder->compileProcessor($builder); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.