Skip to content

Instantly share code, notes, and snippets.

View app.py
import psycopg2
import pandas.io.sql as sqlio
import pandas as pd
import dash
from dash import dcc
from dash import html
import plotly.express as px
app = dash.Dash(__name__)
View metrics-spec.yml
asyncapi: '2.0.0'
info:
title: Metrics Service
version: 1.0.0
description: This service is in charge of providing health data for a computer cluster
servers:
production:
url: 'ws://localhost:8080'
protocol: ws
channels:
View create-postgres-debezium-connector.sh
curl -H 'Content-Type: application/json' debezium:8083/connectors --data '
{
"name": "shipments-connector",
"config": {
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"plugin.name": "pgoutput",
"database.hostname": "postgres",
"database.port": "5432",
"database.user": "postgresuser",
"database.password": "postgrespw",
View docker-compose-postgres+debezium.yml
version: "3.7"
services:
postgres:
image: debezium/postgres:13
ports:
- 5432:5432
healthcheck:
test: "pg_isready -U postgresuser -d shipment_db"
interval: 2s
timeout: 20s
View steps-table.json
{
"tableName": "steps",
"tableType": "REALTIME",
"segmentsConfig": {
"timeColumnName": "loggedAt",
"timeType": "MILLISECONDS",
"schemaName": "steps",
"replicasPerPartition": "1"
},
"tenants": {},
View steps-schema.json
{
"schemaName": "steps",
"dimensionFieldSpecs": [
{
"name": "userId",
"dataType": "INT"
},
{
"name": "userName",
"dataType": "STRING"
View OrderEventHandler.java
package com.edu.samples;
import com.edu.samples.messagelog.MessageLog;
import com.edu.samples.serde.OrderEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
View ConsumedMessage.java
package com.edu.samples.messagelog;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.time.Instant;
@Entity
@Table(name = "consumed_messages")
public class ConsumedMessage {
View credit-limit-alert.sql
@App:name("CreditLimitReaching")
@App:description("Description of the plan")
@Store(type="rdbms",
jdbc.url="jdbc:mysql://localhost:3306/foobank?useSSL=false",
username="root",
password="*****" ,
jdbc.driver.name="com.mysql.jdbc.Driver")
@PrimaryKey("id")
View edu.orders@OrderConfirmed.json
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "OrderConfirmed"
},
"paths": {},
"components": {
"schemas": {
"AWSEvent": {