From acc
Generates PHP 8.4 unified message broker interface with RabbitMQ, Kafka, SQS adapters, JSON serialization, factory, InMemory test adapter, and unit tests. For multi-broker support, testing isolation, and migrations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/acc:create-message-broker-adapterThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Creates unified message broker abstraction with adapter implementations for multiple broker technologies.
Creates unified message broker abstraction with adapter implementations for multiple broker technologies.
| Scenario | Example |
|---|---|
| Broker abstraction | Switch between RabbitMQ/Kafka/SQS without code changes |
| Multi-broker support | Different brokers for different bounded contexts |
| Testing isolation | InMemory adapter for tests |
| Migration path | Gradual migration from one broker to another |
| Vendor independence | Avoid lock-in to specific message broker |
Determine:
Domain Layer (src/Domain/Shared/Messaging/)
Message.php — Immutable message value objectMessageBrokerInterface.php — Broker portMessageSerializerInterface.php — Serialization contractMessageId.php — Message identity value objectInfrastructure Layer (src/Infrastructure/Messaging/)
JsonMessageSerializer.php — JSON serializerRabbitMq/RabbitMqAdapter.php — RabbitMQ implementationKafka/KafkaAdapter.php — Kafka implementationSqs/SqsAdapter.php — AWS SQS implementationInMemory/InMemoryAdapter.php — Testing adapterMessageBrokerFactory.php — Config-based adapter factoryTests
MessageTest.phpJsonMessageSerializerTest.phpInMemoryAdapterTest.phpMessageBrokerFactoryTest.php| Layer | Path |
|---|---|
| Domain Types | src/Domain/Shared/Messaging/ |
| Infrastructure | src/Infrastructure/Messaging/ |
| Broker Adapters | src/Infrastructure/Messaging/{Broker}/ |
| Unit Tests | tests/Unit/{Layer}/{Path}/ |
| Component | Pattern | Example |
|---|---|---|
| Interface | MessageBrokerInterface | MessageBrokerInterface |
| Message VO | Message | Message |
| Adapter | {Broker}Adapter | RabbitMqAdapter |
| Serializer | {Format}MessageSerializer | JsonMessageSerializer |
| Factory | MessageBrokerFactory | MessageBrokerFactory |
| Test | {ClassName}Test | RabbitMqAdapterTest |
interface MessageBrokerInterface
{
public function publish(Message $message, string $routingKey = ''): void;
public function consume(string $queue, callable $handler): void;
public function acknowledge(Message $message): void;
public function reject(Message $message, bool $requeue = false): void;
}
final readonly class Message
{
public function __construct(
public MessageId $id,
public string $body,
public string $routingKey = '',
public array $headers = [],
public ?string $correlationId = null,
public ?string $contentType = 'application/json',
public ?\DateTimeImmutable $timestamp = null,
) {}
public static function create(string $body, string $routingKey = '', array $headers = []): self;
public function withHeader(string $key, string $value): self;
public function withCorrelationId(string $correlationId): self;
}
// Publish
$message = Message::create(
body: json_encode(['order_id' => $orderId, 'total' => $total]),
routingKey: 'orders.created'
);
$broker->publish($message);
// Consume
$broker->consume('order_processing', function (Message $message) use ($handler) {
$handler->handle($message);
$this->broker->acknowledge($message);
});
Domain\Shared\Messaging\MessageBrokerInterface:
factory: ['@Infrastructure\Messaging\MessageBrokerFactory', 'create']
arguments:
$driver: '%env(MESSAGE_BROKER_DRIVER)%'
For complete PHP templates and test examples, see:
references/templates.md — All component templatesreferences/examples.md — Order event publishing example and unit testsnpx claudepluginhub dykyi-roman/awesome-claude-code --plugin accGenerates Transactional Outbox pattern components for PHP 8.4: OutboxMessage entity, repository interface and impl, publisher ports, processor service, console command, Doctrine migration, and unit tests. For reliable event publishing across transactions.
Covers asynchronous messaging patterns in .NET with Wolverine and MassTransit: outbox pattern, saga/choreography, and broker config for RabbitMQ and Azure Service Bus.
Implements message queues with RabbitMQ, Kafka, Redis Streams, AWS SQS/SNS, Pub/Sub. Covers DLQs, idempotency, ordering guarantees, consumer groups, backpressure, serialization for async communication and event-driven architectures.