Urgent.News

What's breaking now, across thousands of outlets.

Tech

Put a test message on a Kafka topic without writing a producer first

You wrote a consumer and want to see it handle one message. Writing a throwaway producer app for that is slow. Here are three ways to do it, from fastest to most realistic. 1. One message with kcat kcat reads from stdin and produces to a topic. -K: tells it the key and value are separated by a colon, and -H adds a header. echo…

Producing a test message to a Kafka topic without creating a producer application entails employing a few methods, ranging from the quickest to the most accurate. These techniques enable you to swiftly validate a consumer's ability to handle a message without the complexity of a full producer setup.

The first approach utilizes the `kcat` command-line tool, which reads from the standard input and forwards data to a Kafka topic. By specifying options such as `K` to define the delimiter separating the key and value, and `H` to include headers, one can craft a message. The command example provided utilizes `echo` to generate a sample message with a key, JSON payload, and custom headers.

However, the primary caution noted is the delimiter's role; it splits the input at the first colon, so selecting a delimiter that is unlikely to appear within the key is crucial.

For generating multiple messages, one can draft a text file where each line contains a key-value pair separated by a colon. Executing `kcat` with the `-l` option allows the tool to read the file line by line, thereby distributing messages across Kafka partitions based on key values. This method proves useful when a consumer's logic depends on messages being processed in a specific order within a partition, as messages with identical keys are routed to the same partition.

In scenarios where the consumer necessitates headers or the same serialization as the production environment, the third method involves crafting a `ProducerRecord` in Java. This involves initializing a `ProducerRecord` with the topic and key, serializing the payload using an object mapper, and then adding headers as byte arrays.

It is essential to ensure that the character encoding used for headers matches that of the consumer to avoid any decoding issues. This approach offers a more authentic test, particularly when headers and serialization are integral to the consumer's operation.

To verify that the message has been successfully produced and received, the `kcat` tool can be employed again in a different configuration. By specifying options that include reading the last message from each partition (`-C -o -1 -e`) and formatting the output to display key, headers, and value, you can confirm the presence of the generated message.

Crucially, the key should match what was produced, indicating that the delimiter used in the message creation aligns correctly. This final step validates the complete flow from message generation to confirmation, ensuring the integrity of the testing process.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Apache Allura Exposes a Permission Chain, Not a Single Admin Page

Apache Allura Exposes a Permission Chain, Not a Single Admin Page Apache Allura combines source repositories, tickets, wikis, discussions, blogs, and project administration into a forge.

  • Apache Allura integrates multiple tools for software development and collaboration.
  • Access decisions in Apache Allura are based on a complex permission chain.
  • Evaluating Apache Allura security requires testing beyond the project landing page.

SSH Certificate Authentication with ssh-keygen (2026)

You have forty devices in the field, three people who need shell access, and an authorized_keys file on every one of them. Someone leaves, and you get to touch forty files.

  • SSH certificate authentication simplifies managing shell access across devices
  • User and host certificates signed by user and host CAs, respectively
  • Server verifies CA signature, validity window, and principals during login

Getting Started with the TTSFree API: Generate Hindi Speech with cURL

Getting Started with the TTSFree API: Generate Hindi Speech with cURL TTSFree.in provides an API for developers who want to integrate AI text-to-speech and other audio capabilities into their…

  • TTSFree.in provides API for text-to-speech in Indian languages, including Hindi.
  • Generate Hindi speech using cURL by sending POST request to https://ttsfree.in/v1/jobs.
  • Download generated speech file as hello.wav after job completion.

LNbits 1.7.0: check your version, then rotate what the old one could see

What happened On 10 November 2026 LNbits published v1.7.0, a critical security release. The project's notice says every version before 1.7.0 is affected and that funds on those versions can be stolen.

  • LNbits released version 1.7.0 on November 10th, 2026
  • Critical security issue addressed in the update
  • Operators urged to upgrade and reset wallet keys

More from Wednesday 11 November →