Skip to content

Commit 068bbda

Browse files
committed
save work
1 parent 78add81 commit 068bbda

File tree

6 files changed

+124
-0
lines changed

6 files changed

+124
-0
lines changed

content/kafkaException/__construct.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
```

content/kafkaException/_index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "KafkaException"
3+
date: 2020-12-27T22:09:37+01:00
4+
draft: false
5+
geekdocCollapseSection: true
6+
---
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
```

content/kafkaException/isFatal.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
```

content/kafkaException/isRetriable.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
```

0 commit comments

Comments
 (0)