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
func(m *nats.Msg) { | |
// process m | |
_, err := nc.Request(m.reply, []byte("+ACK"), 2*time.Second) | |
// err here means ack was not confirmed | |
} |
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
--- | |
version: '3' | |
services: | |
external.example.net: | |
image: nats | |
command: >- | |
--tlscert /etc/nats/tls/external.example.net.cert | |
--tlskey /etc/nats/tls/external.example.net_u.key | |
--tlscacert /etc/nats/tls/ca-cert.pem | |
--client_advertise external.example.net:4222 |
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
nc.Subscribe("test", func(m *nats.Msg) { | |
for h, vals := range m.Header { | |
for _, val := range vals { | |
log.Printf("%s: %s", h, val) | |
} | |
} | |
if m.Reply != "" { | |
msg := nats.NewMsg(m.Reply) | |
msg.Header.Add("X-Demo", "value") |
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
func main() { | |
nc, _ := nats.Connect("localhost") | |
stream := "ORDERS" | |
consumer := "NEW" | |
for { | |
msg, err := nc.Request("$JS.API.CONSUMER.MSG.NEXT."+stream+"."+consumer, 5*time.Second) | |
if err != nil { | |
fmt.Printf("pull failed, maybe no work available: %s", err) |
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
name: check_httpd | |
version: 1.0.0 | |
initial_state: unknown | |
watchers: | |
# check httpd every minute | |
- name: check | |
type: nagios | |
interval: 1m | |
properties: |
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
$ helm install --namespace choria-iot broker choria/broker --values values.yaml | |
$ kubectl -n choria-iot logs pod/broker-broker-6bf64bb74d-5j75t | |
time="2020-06-12T15:01:44Z" level=info msg="Attempting to enroll with Cert Manager in namespace \"choria-iot\" using issuer \"provisioner-provisioner\"" component=security ssl=certmanager | |
time="2020-06-12T15:01:44Z" level=info msg="Submitting CSR for \"broker-broker-6bf64bb74d-5j75t\" to Cert Manager" component=security ssl=certmanager | |
time="2020-06-12T15:01:44Z" level=info msg="Attempt 1 at fetching certificate \"broker-broker-6bf64bb74d-5j75t\"" component=security ssl=certmanager | |
time="2020-06-12T15:01:44Z" level=info msg="Enrollment with Cert Manager completed in namespace \"choria-iot\"" component=security ssl=certmanager | |
time="2020-06-12T15:01:44Z" level=info msg="Choria Broker version 0.14.0 starting with config /etc/choria/config/broker.conf" | |
time="2020-06-12T15:01:44Z" level=info msg="Starting Network Broker" | |
time="2020-06-12T15:01:44Z" level=error msg="SRV lo |
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
{ | |
"annotations": { | |
"list": [ | |
{ | |
"builtIn": 1, | |
"datasource": "-- Grafana --", | |
"enable": true, | |
"hide": true, | |
"iconColor": "rgba(0, 211, 255, 1)", | |
"name": "Annotations & Alerts", |
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
msg := nats.NewMsg("subject") | |
msg.Data = []byte("hello world") | |
msg.Header.Add("X-Hello", "World") | |
nc.PublishMsg(msg) |
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
package main | |
import ( | |
"context" | |
"crypto/sha1" | |
"sync" | |
"time" | |
"github.com/nats-io/nats.go" | |
"github.com/reactivex/rxgo/v2" |
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
% dig srv _mcollective-server._tcp.example.net | |
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> srv _mcollective-server._tcp.example.net | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15789 | |
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 2, ADDITIONAL: 2 | |
;; QUESTION SECTION: | |
;_mcollective-server._tcp.example.net. IN SRV |