This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bumpme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable @typescript-eslint/no-var-requires */ | |
/** | |
* this script will list packages in topological order (dependencies before dependents) | |
* and execute the given command in sequence | |
* it will substitute any {package} found on the command by the actual package of the current cursor. | |
* We no longer trust lerna to build in topological order. | |
*/ | |
const { exec, execSync } = require('child_process'); | |
const colors = require('colors'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable @typescript-eslint/no-var-requires */ | |
/** | |
* this script will list packages in topological order (dependencies before dependents) | |
* and execute the given command in sequence | |
* it will substitute any {package} found on the command by the actual package of the current cursor. | |
* We no longer trust lerna to build in topological order. | |
*/ | |
const {execSync} = require('child_process'); | |
const colors = require('colors'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { injectable } from 'inversify'; | |
import { FrontendApplicationContribution, FrontendApplication } from '@theia/core/lib/browser'; | |
import { MaybePromise } from '@theia/core/lib/common/types'; | |
import { Widget } from '@theia/core/lib/browser/widgets'; | |
@injectable() | |
export class ExampleFrontendContribution implements FrontendApplicationContribution { | |
/** | |
* Called after the application shell has been attached in case there is no previous workbench layout state. | |
* Should return a promise if it runs asynchronously. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"eslintConfig": { | |
"parser": "@typescript-eslint/parser", | |
"plugins": [ | |
"@typescript-eslint" | |
], | |
"extends": [ | |
"plugin:@typescript-eslint/recommended" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Experimenting with Kafka</title> | |
<link rel="stylesheet" href="css/styles.css" /> | |
<script type="module" src="dist/client/app.js"></script> | |
</head> | |
<body> | |
<h1>Experimenting with Kafka</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { css, CSSResult, LitElement, html, customElement, property, TemplateResult } from 'lit-element'; | |
@customElement('kafka-consumer') | |
export class KafkaConsumer extends LitElement { | |
@property({ type: Array }) | |
private message: string; | |
public static get styles(): CSSResult { | |
return css` | |
div { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as dotenv from 'dotenv'; | |
import { Server, Message, WebSocketClient } from 'ws'; | |
import * as express from 'express'; | |
import { kafkaSubscribe } from './consumer'; | |
dotenv.config(); | |
const PORT: number = parseInt(process.env.PORT) || 3210; | |
const app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/** | |
* CLI tool to publish messages to Kafka topics | |
*/ | |
import * as program from 'commander'; | |
import { publish } from './producer'; | |
program | |
.version('0.0.1') | |
.usage('[options] <message>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { KafkaClient as Client, Consumer, Message, Offset, OffsetFetchRequest, ConsumerOptions } from 'kafka-node'; | |
const kafkaHost = 'localhost:9092'; | |
export function kafkaSubscribe(topic: string): void { | |
const client = new Client({ kafkaHost }); | |
const topics: OffsetFetchRequest[] = [{ topic: topic, partition: 0 }]; | |
const options: ConsumerOptions = { autoCommit: false, fetchMaxWaitMs: 1000, fetchMaxBytes: 1024 * 1024 }; | |
const consumer = new Consumer(client, topics, options); |
NewerOlder