Skip to content

Instantly share code, notes, and snippets.

View taonic's full-sized avatar
🎯
Focusing

Tao Guo taonic

🎯
Focusing
View GitHub Profile
@taonic
taonic / java_sdk_grafana.json
Last active March 18, 2024 11:25
Temporal SDK Metrics (Grafana, Java) real time
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
@taonic
taonic / timeout_interceptor.go
Created March 8, 2024 11:15
timeout_interceptor.go
package main
import (
"context"
"errors"
"log"
"time"
"github.com/google/uuid"
"go.temporal.io/sdk/client"
@taonic
taonic / OrderedUpdateWithWorkflowQueue.java
Last active March 2, 2024 00:24
Ordered Update with WorkflowQueue - Temporal Java SDK
/*
* Copyright (c) 2020 Temporal Technologies, Inc. All Rights Reserved
*
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
@taonic
taonic / ConcurrentUpdates.java
Last active February 29, 2024 05:56
Concurrent Updates without Ordered Commands
/*
* Copyright (c) 2020 Temporal Technologies, Inc. All Rights Reserved
*
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
@taonic
taonic / HelloContextInjectionActivity.java
Created December 8, 2023 09:46
HelloContextInjectionActivity
/*
* Copyright (c) 2020 Temporal Technologies, Inc. All Rights Reserved
*
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
@taonic
taonic / gist:f838b40d54f433451f75e917bc674ad9
Created June 2, 2023 07:03
Temporal event history vs batch
➜ temporal git:(master) tctl admin wf show --namespace_id 807d120c-1c9d-4ca4-800b-170f1115e93e --workflow_id hello_world_workflowID3d7d8225-ceb7-4442-9e64-4d2fd4d80258 --run_id 907c8a43-1f57-4f53-b6e2-a15c4a06dde6
======== batch 1, blob len: 267 ======
[{"eventId":"1","eventTime":"2023-06-02T01:05:54.563102721Z","eventType":"WorkflowExecutionStarted","taskId":"2097152","workflowExecutionStartedEventAttributes":{"workflowType":{"name":"Workflow"},"taskQueue":{"name":"hello-world","kind":"Normal"},"input":{"payloads":[{"metadata":{"encoding":"anNvbi9wbGFpbg=="},"data":"IlRlbXBvcmFsIg=="}]},"workflowExecutionTimeout":"0s","workflowRunTimeout":"0s","workflowTaskTimeout":"12s","originalExecutionRunId":"907c8a43-1f57-4f53-b6e2-a15c4a06dde6","identity":"9715@MacBook-Pro.local@","firstExecutionRunId":"907c8a43-1f57-4f53-b6e2-a15c4a06dde6","attempt":1,"firstWorkflowTaskBackoff":"0s","header":{}}},{"eventId":"2","eventTime":"2023-06-02T01:05:54.563193513Z","eventType":"WorkflowTaskScheduled","taskId":"2097153","workfl
@taonic
taonic / activity.go
Created May 15, 2023 13:13
samples-go/cancellation/activity.go with panic
package cancellation
import (
"errors"
"fmt"
"time"
"go.temporal.io/sdk/workflow"
)
@taonic
taonic / zis_engine_drawio.js
Last active June 27, 2019 22:02
ZIS Engine Draw.io plugin
mxscript("https://cdn.rawgit.com/soney/jsep/b8baab7b/build/jsep.min.js");
mxscript("https://cdn.rawgit.com/nodeca/js-yaml/9c1894e2/dist/js-yaml.min.js");
mxscript("https://sdk.amazonaws.com/js/aws-sdk-2.9.0.min.js");
mxscript("https://cdnjs.cloudflare.com/ajax/libs/dropbox.js/4.0.17/Dropbox-sdk.min.js")
// mxscript("https://rawgit.com/soney/jsep/master/build/jsep.min.js");
// mxscript("https://localhost:8000/js/aws-sdk-2.9.0.js");
// mxscript("https://localhost:8000/js/jsep.min.js");
Draw.loadPlugin(function(ui) {
awssfUtils = {
@taonic
taonic / complete-flow.json
Last active June 13, 2019 12:59
Ticket notifier complete flow
{
"StartAt": "LoadConfig",
"States": {
"LoadConfig": {
"Type": "Action",
"ActionName": "LoadConfig",
"Parameters": {
"scope.$": "account:{{$.event.account_id}}",
"subdomain": "$.event.subdomain",
"integration": "ticket_notifier"
@taonic
taonic / Spark.go
Created June 6, 2019 01:24
Spark.go generated by go-swagger
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"