Skip to content

Commit e4cccab

Browse files
committed
save work
1 parent 4e45c2e commit e4cccab

17 files changed

+229
-7
lines changed

content/configuration/_index.php

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "Configuration"
3+
date: 2020-12-27T22:09:37+01:00
4+
draft: false
5+
geekdocCollapseSection: false
6+
---

content/configuration/dump.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: "dump"
3+
date: 2020-12-27T22:09:37+01:00
4+
draft: false
5+
geekdocCollapseSection: true
6+
---
7+
## Description
8+
```php
9+
public function dump(): array {}
10+
```
11+
Dumps the current configuration
12+
13+
## Example
14+
```php
15+
$conf = new Kafka\Configuration();
16+
$conf->set('auto.offset.reset', 'earliest');
17+
$conf->dump();
18+
```

content/configuration/set.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: "set"
3+
date: 2020-12-27T22:09:37+01:00
4+
draft: false
5+
geekdocCollapseSection: true
6+
---
7+
## Description
8+
```php
9+
public function set(string $name, string $value): void {}
10+
```
11+
Set a configuration value
12+
13+
## Example
14+
```php
15+
$conf = new Kafka\Configuration();
16+
$conf->set('auto.offset.reset', 'earliest');
17+
```

content/configuration/setDrMsgCb.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: "setDrMsgCb"
3+
date: 2020-12-27T22:09:37+01:00
4+
draft: false
5+
geekdocCollapseSection: true
6+
---
7+
## Description
8+
```php
9+
public function setDrMsgCb(callable $callback): void {}
10+
```
11+
Set a message delivery report callback
12+
This callback is called exactly once per message, indicating if
13+
the message was succesfully delivered or permanently failed delivery
14+
15+
## Example
16+
```php
17+
$conf = new Kafka\Configuration();
18+
$conf->setDrMsgCb(
19+
function (Producer $kafka, Message $message) {
20+
if (RD_KAFKA_RESP_ERR_NO_ERROR !== $message->err) {
21+
$errorStr = rd_kafka_err2str($message->err);
22+
23+
echo sprintf('Message FAILED (%s, %s) to send with payload => %s', $message->err, $errorStr, $message->payload) . PHP_EOL;
24+
} else {
25+
// message successfully delivered
26+
echo sprintf('Message sent SUCCESSFULLY with payload => %s', $message->payload) . PHP_EOL;
27+
}
28+
}
29+
);
30+
```

content/configuration/setErrorCb.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: "setErrorCb"
3+
date: 2020-12-27T22:09:37+01:00
4+
draft: false
5+
geekdocCollapseSection: true
6+
---
7+
## Description
8+
```php
9+
public function setErrorCb(callable $callback): void {}
10+
```
11+
Gets triggered for every error that occurs in `librdkafka`, keep in mind
12+
that non-critical errors will be retried by `libdrkafka`
13+
14+
## Example
15+
```php
16+
$conf = new Kafka\Configuration();
17+
$conf->setErrorCb(
18+
function (Kafka\Kafka $kafka, $errorCode, $reason) {
19+
//do something
20+
}
21+
);
22+
```

content/configuration/setLogCb.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: "setLogCb"
3+
date: 2020-12-27T22:09:37+01:00
4+
draft: false
5+
geekdocCollapseSection: true
6+
---
7+
## Description
8+
```php
9+
public function setLogCb(callable $callback): void {}
10+
```
11+
Setting a Log callback, you will get events according to the `log_level` you set
12+
13+
## Example
14+
```php
15+
$conf = new Kafka\Configuration();
16+
$conf->setLogCb(
17+
function (Kafka\Kafka $kafka, int $level, string $facility, string $message) {
18+
//do something
19+
}
20+
);
21+
```
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: "setOffsetCommitCb"
3+
date: 2020-12-27T22:09:37+01:00
4+
draft: false
5+
geekdocCollapseSection: true
6+
---
7+
## Description
8+
```php
9+
public function setOffsetCommitCb(callable $callback): void {}
10+
```
11+
Set offset commit callback for use with consumer groups.
12+
The results of automatic or manual offset commits will be scheduled
13+
for this callback. If no partitions had valid offsets to commit
14+
this callback will be called with `err == RD_KAFKA_RESP_ERR__NO_OFFSET`
15+
which is not to be considered an error.
16+
## Example
17+
```php
18+
$conf = new Kafka\Configuration();
19+
$conf->setOffsetCommitCb(
20+
function (Kafka\Kafka $kafka, int $errorCode, array $topicPartition) {
21+
if (RD_KAFKA_RESP_ERR_NO_ERROR === $errorCode) {
22+
echo 'Commit was successful';
23+
} else {
24+
echo 'Commit failed';
25+
}
26+
}
27+
);
28+
```
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: "setRebalanceCb"
3+
date: 2020-12-27T22:09:37+01:00
4+
draft: false
5+
geekdocCollapseSection: true
6+
---
7+
## Description
8+
```php
9+
public function setRebalanceCb(callable $callback): void {}
10+
```
11+
Set a rebalance callback for use with coordinated consumer group balancing.
12+
The `$errorCode` is set to either `RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS`
13+
or `RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS` and 'partitions' contains
14+
the full partition set that was either assigned or revoked.
15+
16+
Registering a rebalance callback turns off the automatic partition
17+
assignment/revocation and instead delegates that responsibility
18+
to the application's callback.
19+
20+
## Example
21+
```php
22+
$conf = new Kafka\Configuration();
23+
$conf->setRebalanceCb(
24+
function (Kafka\Consumer $kafka, int $errorCode, array $partitions = null) {
25+
case RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS:
26+
$kafka->assign($partitions);
27+
break;
28+
29+
case RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS:
30+
if ($manual_commits) {
31+
// Optional explicit manual commit
32+
$kafka->commit($partitions);
33+
}
34+
//revoke partitions
35+
$kafka->assign(NULL);
36+
break;
37+
38+
default:
39+
// handle arbitrary rebalancing failure
40+
...
41+
// synchronize state
42+
$kafka->assign(NULL);
43+
break;
44+
}
45+
);
46+
```

content/configuration/setStatsCb.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: "setStatsCb"
3+
date: 2020-12-27T22:09:37+01:00
4+
draft: false
5+
geekdocCollapseSection: true
6+
---
7+
## Description
8+
```php
9+
public function setStatsCb(callable $callback): void {}
10+
```
11+
Set a statistics callback
12+
The statistics callback is triggered every `statistics.interval.ms` (needs to be configured separately).
13+
## Example
14+
```php
15+
$conf = new Kafka\Configuration();
16+
$conf->setStatsCb(
17+
function (Kafka\Kafka $kafka, string $json, int $jsonLength) {
18+
//do something
19+
}
20+
);
21+
```

content/consumer/_index.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
title: "Consumer"
33
date: 2020-12-27T22:09:37+01:00
44
draft: false
5-
geekdocCollapseSection: true
5+
geekdocCollapseSection: false
66
---
7-
asadf asfa sdfasfasf

content/functions/_index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2+
title: "Functions"
23
date: 2020-12-27T22:09:37+01:00
34
draft: false
4-
geekdocCollapseSection: true
5+
geekdocCollapseSection: false
56
---

content/functions/kafka_err2name.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ date: 2020-12-27T22:09:37+01:00
44
draft: false
55
geekdocCollapseSection: true
66
---
7+
## Description
78
```php
89
function kafka_err2name(int $errorCode): string {}
910
```
10-
Returns the name of the error, e.g.:
11+
Returns the name of the error
12+
## Example
1113
```shell
1214
php> echo kafka_err2name(88);
1315
UNSTABLE_OFFSET_COMMIT

content/functions/kafka_err2str.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ date: 2020-12-27T22:09:37+01:00
44
draft: false
55
geekdocCollapseSection: true
66
---
7+
## Description
78
```php
89
function kafka_err2str(int $errorCode): string {}
910
```
10-
Returns the error message of an error code, e.g.:
11+
Returns the error message of an error code
12+
## Example
1113
```shell
1214
php> echo kafka_err2str(88);
1315
Broker: There are unstable offsets that need to be cleared

content/functions/kafka_get_err_descs.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ date: 2020-12-27T22:09:37+01:00
44
draft: false
55
geekdocCollapseSection: true
66
---
7+
## Description
78
```php
89
function kafka_get_err_descs(): array {}
910
```
10-
Returns a full list of error codes and their description, see example:
11+
Returns a full list of error codes and their description
12+
## Result structure
1113
```php
1214
[
1315
[

content/functions/kafka_offset_tail.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ date: 2020-12-27T22:09:37+01:00
44
draft: false
55
geekdocCollapseSection: true
66
---
7+
## Description
78
```php
89
function kafka_offset_tail(int $offset): int {}
910
```
10-
Returns an offset value that is `$offset` before the tail of the topic.
11+
Returns an offset value that is `$offset` before the tail of the topic
1112

1213

content/functions/kafka_thread_cnt.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ date: 2020-12-27T22:09:37+01:00
44
draft: false
55
geekdocCollapseSection: true
66
---
7+
## Description
78
```php
89
function kafka_thread_cnt(): int {}
910
```

content/producer/_index.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: "Producer"
3+
date: 2020-12-27T22:09:37+01:00
4+
draft: false
5+
---

0 commit comments

Comments
 (0)