akeneo-presales/custom-app-essentials-bundle
Installation
composer require akeneo-presales/custom-app-essentials-bundle
Routing Configuration
Add to config/routes.yaml:
akeneo_presales_custom_app_essentials:
resource: "@AkeneoPresalesCustomAppEssentialsBundle/Controller"
type: attribute
Tenant Entity Implementation
Implement TenantInterface on your tenant entity:
use AkeneoPresales\CustomAppEssentialsBundle\Entity\TenantInterface;
class YourTenantEntity implements TenantInterface
{
// Implement required methods (e.g., getId(), getName())
}
First Use Case: Event Platform UI Access the event platform management UI via:
<a href="{{ path('akeneo_presales_custom_app_essentials_event_platform_configuration') }}">Event Platform</a>
Dependency Injection: Inject PubSubService or GraphQLService into your services:
use AkeneoPresales\CustomAppEssentialsBundle\Service\PubSubService;
public function __construct(
private PubSubService $pubSubService
) {}
Tenant-Aware Operations:
$this->pubSubService->publish('event.topic', $data, $tenantId);
Subscriber Configuration:
Use the UI to register subscribers (e.g., Akeneo\Tool\EventPlatformBundle\Subscriber\SubscriberInterface).
Programmatically, configure via:
# config/packages/akeneo_event_platform.yaml
akeneo_event_platform:
subscribers:
- 'App\Subscriber\YourSubscriber'
Subscription Management:
$this->pubSubService->subscribe('topic', $callback, $tenantId);
Query Execution:
$result = $this->graphQLService->query($tenantId, $query, $variables);
Mutation Handling:
$this->graphQLService->mutate($tenantId, $mutation, $variables);
// In a custom bundle
$extension = new YourUIExtension();
$this->uiExtensionManager->addExtension($extension);
Event Platform Issues:
akeneo.event_platform.subscriber.Akeneo\Tool\EventPlatformBundle errors.Pub/Sub Delays:
async mode for non-critical events:
$this->pubSubService->publishAsync('topic', $data, $tenantId);
Tenant Isolation:
Ensure TenantInterface is implemented correctly. Missing methods (e.g., getId()) will cause runtime errors.
// Example fix
public function getId(): ?int
{
return $this->id;
}
GraphQL Client:
$this->graphQLService->setCacheEnabled(true);
Custom Pub/Sub Backends:
Override PubSubService to support alternative providers (e.g., RabbitMQ):
// src/Service/CustomPubSubService.php
class CustomPubSubService extends PubSubService
{
public function __construct(private RabbitMQClient $client) {}
public function publish(string $topic, $data, ?int $tenantId): void
{
$this->client->publish($topic, $data);
}
}
Event Platform Extensions:
Create custom event types by extending Akeneo\Tool\EventPlatformBundle\Event\EventInterface and register them via:
akeneo_event_platform:
events:
- 'App\Event\YourCustomEvent'
Batch Processing:
Use PubSubService::publishBatch() for high-volume events:
$this->pubSubService->publishBatch(['topic1' => $data1, 'topic2' => $data2], $tenantId);
GraphQL Query Optimization: Limit fields in queries to reduce payload size:
$query = <<<'GRAPHQL'
query {
products {
id
sku
}
}
GRAPHQL;
How can I help you explore Laravel packages today?