npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kafka-replay-service

v0.2.2

Published

A simple service to play (publish) a sequence of messages to a Kafka topic.

Downloads

9

Readme

Kafka-Replay-Service

A simple REST (+websockets) service to play (publish) a sequence of messages to a Kafka topic. The messages you can play are based on their location in a folder (following the convention over configuration principle). The folder is actively watched, and new files will be automatically available.

Replay logged messages that are stored inside a, potentially mounted, folder. The folder layout is using the following convention, so you can either write your own message, one message per file, or, alternatively, use a log file from Landoop's Kafka TOPICS UI:

ROOT

  • logs
    • SESSION_NAME
      • TOPIC_NAME
        • TIMESTAMP_FILENAME
    • SESSION_NAME2
      • [Kafka TOPICS UI log file].json

Messages that belong to each other are added to the same session. The topic name is the name of the topic to publish the messages to. When a TIMESTAMP (a number in msec) is set, it is used to send the message after TIMESTAMP msec.

The REST API is documented using OpenAPI/Swagger at http://[HOST]:[PORT]/api-docs/.

The GUI is available at http://[HOST]:[PORT]/api-docs/.

Via websockets, your client may receive a session_update notification that something has changed, after which you should GET all session data again.

Filename convention for single messages

The message file's filename convention informs us when to send it:

  • It is just a name: you can publish them step-by-step or all in one go
  • It is in the format 12345... (only numbers, or, in Regex /d+): it represents the offset in msec since you pressed play
  • Optionally, the previous format may be augmented by a textual description, such as 0001_Init_msg, in which case the 'Init msg' is used as the label of the message in the GUI.

Extension

Finally, the message file's extension informs us how to read it. We support the following inputs:

  • .xml, for XML messages
  • .json or .geojson for JSON and GeoJSON messages, respectively.

Use cases (TO BE DONE)

Playback step-by-step

The user can select a session_name from the GUI, and either send messages by selecting them, and pressing play, or by sending them one after another (batch mode). In case we are dealing with multiple topics, the user can unselect specific topics in batch mode.

Playback scenario-based

Finally, if there is a time message signal on the test-bed, playback messages based on the external clock. The scenario duration is used to determine when to send a message.

Build instructions

From the command prompt, install all dependencies using npm i. Under Windows, using Node v9, you may run into an installation error when installing node-expat. In that case, you can try the following:

npm i -g node-gyp
cd node_modules\node-expat
node-gyp rebuild

Optionally, you may also need to install the npm production tools, from an admin prompt: npm install --global --production windows-build-tools.

Next, run npm start to compile the TypeScript code to JavaScript.