|
| 1 | +# Upgrade to 1.0 |
| 2 | + |
| 3 | +## Avro encoding / decoding |
| 4 | +Has been removed as a fixed dependency. If you rely on it you need to run |
| 5 | +the following in your project: |
| 6 | +``` |
| 7 | +composer require flix-tech/avro-serde-php "~1.3" |
| 8 | +``` |
| 9 | + |
| 10 | +## Producer improvements |
| 11 | +Producer used to poll all events after `produce`, now per default only one |
| 12 | +non-blocking poll call will be triggered after `produce`. |
| 13 | +This improvement was made so higher throughput can be achieved if needed. |
| 14 | +This affects the following classes: |
| 15 | +- KafkaProducer |
| 16 | + - Added `syncProduce` - waits indefinitely for an event to be polled |
| 17 | + - Added `poll` - gives you the ability to poll, especially useful if you disable auto poll for `produce` |
| 18 | + - Added `pollUntilQueueSizeReached` - polls until the poll queue has reached a certain size |
| 19 | + - Changed `produce`, changed behaviour (see above), has new optional parameters `$autoPoll` and `$pollTimeoutMs` |
| 20 | + |
| 21 | +To achieve the previous default behaviour change (e.g. suited for REST API applications which trigger a message on call): |
| 22 | +``` |
| 23 | +$producer->produce($message); |
| 24 | +``` |
| 25 | +to |
| 26 | +``` |
| 27 | +$producer->produce($message, false); |
| 28 | +$producer->pollUntilQueueSizeReached(); // defaults should work fine |
| 29 | +``` |
| 30 | + |
| 31 | +## Possibility to decode message later (Consumer) |
| 32 | +Consume has now a second optional parameter `consume(int $timeoutMs = 10000, bool $autoDecode = true)`. |
| 33 | +If set to false, you must decode your message later using `$consumer->decodeMessage($message)`. |
| 34 | +For high throughput, you don't need to decode immediately, some decisions can be made |
| 35 | +relying on the message headers alone. This helps to leverage that. |
| 36 | + |
| 37 | +## Remove timout from builder / configuration, added timeout parameter to functions (Consumer / Producer) |
| 38 | +You were able to set timeout in the builder, but some methods |
| 39 | +still had `timeout` as parameter. To avoid confusion, every method |
| 40 | +needing a timeout, will now have it as a parameter with a sane default value. |
| 41 | +This affects the following classes: |
| 42 | +- KafkaConfiguration |
| 43 | + - Removed timeout parameter from `__construct()` |
| 44 | + - Removed `getTimeout()` |
| 45 | +- KafkaConsumerBuilder / KafkaConsumerBuilderInterface |
| 46 | + - Removed `withTimeout()` |
| 47 | +- KafkaProducerBuilder / KafkaProducerBuilderInterface |
| 48 | + - Removed `withPollTimeout()` |
| 49 | +- KafkaHighLevelConsumer / KafkaLowLevelConsumer / KafkaConsumerInterface |
| 50 | + - Added `$timeoutMs` to `consume()`, default is 10s |
| 51 | + - Added `$timeoutMs` to `getMetadataForTopic()`, default is 10s |
| 52 | +- KafkaProducer / KafkaProducerInterface |
| 53 | + - Added `pollTimeoutMs` to `produce()`, default is 10s |
| 54 | + - Added `$timeoutMs` to `getMetadataForTopic()`, default is 10s |
| 55 | + |
| 56 | +## Possibility to avro encode / decode both key and body of a message |
| 57 | +The previous default behaviour was to only encode the body of a message. |
| 58 | +Now you are also able to encode / decode message keys. |
| 59 | +This affects the following classes: |
| 60 | +- AvroSchemaRegistry |
| 61 | + - Removed `addSchemaMappingForTopic` |
| 62 | + - Removed `getSchemaForTopic` |
| 63 | + - Added `addBodySchemaMappingForTopic` |
| 64 | + - Added `addKeySchemaMappingForTopic` |
| 65 | + - Added `getBodySchemaForTopic` |
| 66 | + - Added `getKeySchemaForTopic` |
| 67 | + - Behaviour change: Trying to get a schema for which no mapping was registered will throw `AvroSchemaRegistryException` |
| 68 | + - `getTopicSchemaMapping` will still return an array with mappings but with an additional first key `body` or `key` for the type of the schema |
| 69 | +- KafkaMessageInterface |
| 70 | + - type of `key` is now mixed |
| 71 | + |
| 72 | +## Default error callback |
| 73 | +The default error callback now only throws exceptions for fatal errors. |
| 74 | +Other errors will be retried by librdkafka and are only informational. |
0 commit comments