File tree Expand file tree Collapse file tree 6 files changed +124
-0
lines changed Expand file tree Collapse file tree 6 files changed +124
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ title : " __construct"
3
+ date : 2020-12-27T22:09:37+01:00
4
+ draft : false
5
+ ---
6
+ ## Description
7
+ ``` php
8
+ public function __construct(
9
+ string $message,
10
+ int $code,
11
+ string $error_string,
12
+ bool $isFatal,
13
+ bool $isRetriable,
14
+ bool $transactionRequiresAbort
15
+ ) {}
16
+ ```
17
+ Create new ` KafkaErrorException ` , this can be helpful for transaction tests
18
+ ## Example
19
+ ``` php
20
+ throw new Kafka\KafkaErrorException(
21
+ 'Some error message',
22
+ 88,
23
+ 'This is a detailed error string',
24
+ false,
25
+ true,
26
+ false
27
+ );
28
+ ```
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : " KafkaException"
3
+ date : 2020-12-27T22:09:37+01:00
4
+ draft : false
5
+ geekdocCollapseSection : true
6
+ ---
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : " getErrorString"
3
+ date : 2020-12-27T22:09:37+01:00
4
+ draft : false
5
+ ---
6
+ ## Description
7
+ ``` php
8
+ public function getErrorString(): string {}
9
+ ```
10
+ Get error description for this exception
11
+ ## Example
12
+ ``` php
13
+ $conf = Kafka\Configuration();
14
+ $conf->set('metadata.broker.list', 'kafka:9092');
15
+ $producer = new Kafka\Producer($conf);
16
+ try {
17
+ $producer->initTransactions(10000);
18
+ } catch (Kafka\KafkaErrorException $e) {
19
+ echo $e->getErrorString();
20
+ }
21
+ ```
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : " isFatal"
3
+ date : 2020-12-27T22:09:37+01:00
4
+ draft : false
5
+ ---
6
+ ## Description
7
+ ``` php
8
+ public function isFatal(): bool {}
9
+ ```
10
+ Check if it is a fatal exception
11
+ ## Example
12
+ ``` php
13
+ $conf = Kafka\Configuration();
14
+ $conf->set('metadata.broker.list', 'kafka:9092');
15
+ $producer = new Kafka\Producer($conf);
16
+ try {
17
+ $producer->initTransactions(10000);
18
+ } catch (Kafka\KafkaErrorException $e) {
19
+ if ($e->isFatal()) {
20
+ // non-recoverable error
21
+ }
22
+ }
23
+ ```
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : " isRetriable"
3
+ date : 2020-12-27T22:09:37+01:00
4
+ draft : false
5
+ ---
6
+ ## Description
7
+ ``` php
8
+ public function isRetriable(): bool {}
9
+ ```
10
+ Indicates that the operation that caused this exception can be retried.
11
+ ## Example
12
+ ``` php
13
+ $conf = Kafka\Configuration();
14
+ $conf->set('metadata.broker.list', 'kafka:9092');
15
+ $producer = new Kafka\Producer($conf);
16
+ try {
17
+ $producer->initTransactions(10000);
18
+ } catch (Kafka\KafkaErrorException $e) {
19
+ if ($e->isRetriable()) {
20
+ // action can be retried
21
+ }
22
+ }
23
+ ```
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : " transactionRequiresAbort"
3
+ date : 2020-12-27T22:09:37+01:00
4
+ draft : false
5
+ ---
6
+ ## Description
7
+ ``` php
8
+ public function transactionRequiresAbort(): bool {}
9
+ ```
10
+ Check if error needs the transaction to be aborted
11
+ ## Example
12
+ ``` php
13
+ $conf = Kafka\Configuration();
14
+ $conf->set('metadata.broker.list', 'kafka:9092');
15
+ $producer = new Kafka\Producer($conf);
16
+ try {
17
+ $producer->initTransactions(10000);
18
+ } catch (Kafka\KafkaErrorException $e) {
19
+ if ($e->$transactionRequiresAbort()) {
20
+ $producer->abortTransaction(10000);
21
+ }
22
+ }
23
+ ```
You can’t perform that action at this time.
0 commit comments