Skip to content

Instantly share code, notes, and snippets.

View edu.orders@OrderConfirmed.json
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "OrderConfirmed"
},
"paths": {},
"components": {
"schemas": {
"AWSEvent": {
View EmailSender.java
package com.edu.eb;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import schema.edu_orders.orderconfirmed.AWSEvent;
import schema.edu_orders.orderconfirmed.OrderConfirmed;
View EventProducer.java
package com.edu.eb;
import schema.edu_orders.orderconfirmed.AWSEvent;
import schema.edu_orders.orderconfirmed.Customer;
import schema.edu_orders.orderconfirmed.Item;
import schema.edu_orders.orderconfirmed.OrderConfirmed;
import schema.edu_orders.orderconfirmed.marshaller.Marshaller;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.eventbridge.EventBridgeClient;
import software.amazon.awssdk.services.eventbridge.model.*;
View email-service.yaml
asyncapi: 2.0.0
info:
title: Email Service
version: '1.0.0'
description: |
This service is responsible for sending out emails upon certain events
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
View account-service.yaml
asyncapi: 2.0.0
info:
title: Account Service
version: '1.0.0'
description: |
This service is responsible for managing user accounts in the system.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
View dashboard.js
"use strict"
var connected = false;
var socket;
function connect() {
if (! connected) {
var clientId = generateClientId(6);
socket = new WebSocket("ws://" + location.host + "/dashboard/" + clientId);
socket.onopen = function() {
View DashboardWebSocket.java
package com.edu.retail.ws;
import io.quarkus.scheduler.Scheduled;
import javax.enterprise.context.ApplicationScoped;
import javax.websocket.*;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
View cc-docker-compose.yml
---
version: '2'
services:
rabbitmq:
image: rabbitmq:3.7-management
container_name: rabbitmq
expose:
- 5672
- 15672
ports:
View TaskProcessorProxy.xml
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="TaskProcessorProxy" startOnLoad="true" transports="rabbitmq" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log level="custom">
<property expression="//Message/ID" name="[x] Message Received. ID: "/>
</log>
</inSequence>
<outSequence/>
<faultSequence/>
View Todo_service.bal
import ballerina/log;
import ballerina/http;
import ballerina/kubernetes;
@kubernetes:Service {
name : "todos",
serviceType: "LoadBalancer"
}
listener http:Listener todosListener = new(9090);