Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusjunges committed Jan 10, 2024
1 parent d35e7e4 commit 59369a5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .php_cs.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
]
],
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try', 'if'],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
Expand Down
32 changes: 16 additions & 16 deletions src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,23 @@ class Config
private HandlesBatchConfiguration $batchConfig;

public function __construct(
private string $broker,
private array $topics,
private ?string $securityProtocol = null,
private ?int $commit = null,
private ?string $groupId = null,
private ?Consumer $consumer = null,
private ?Sasl $sasl = null,
private ?string $dlq = null,
private int $maxMessages = -1,
private int $maxCommitRetries = 6,
private bool $autoCommit = true,
private array $customOptions = [],
private string $broker,
private array $topics,
private ?string $securityProtocol = null,
private ?int $commit = null,
private ?string $groupId = null,
private ?Consumer $consumer = null,
private ?Sasl $sasl = null,
private ?string $dlq = null,
private int $maxMessages = -1,
private int $maxCommitRetries = 6,
private bool $autoCommit = true,
private array $customOptions = [],
?HandlesBatchConfiguration $batchConfig = null,
private bool $stopAfterLastMessage = false,
private int $restartInterval = 1000,
private array $callbacks = [],
private int $maxTime = 0,
private bool $stopAfterLastMessage = false,
private int $restartInterval = 1000,
private array $callbacks = [],
private int $maxTime = 0,
) {
$this->batchConfig = $batchConfig ?? new NullBatchConfig();
}
Expand Down
7 changes: 5 additions & 2 deletions src/Consumers/Consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ class Consumer implements CanConsumeMessages
protected int $lastRestart = 0;
protected Timer $restartTimer;

public function __construct(private readonly Config $config, MessageDeserializer $deserializer, CommitterFactory $committerFactory = null)
{
public function __construct(
private readonly Config $config,
MessageDeserializer $deserializer,
CommitterFactory $committerFactory = null
) {
$this->logger = app(Logger::class);
$this->messageCounter = new MessageCounter($config->getMaxMessages());
$this->retryable = new Retryable(new NativeSleeper(), 6, self::TIMEOUT_ERRORS);
Expand Down

0 comments on commit 59369a5

Please sign in to comment.