This file contains hidden or 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 ( | |
"fmt" | |
czmq "github.com/zeromq/goczmq" | |
) | |
func main() { | |
serverCert, _ := czmq.NewCertFromFile("/etc/curve.d/example_curve_server_cert") |
This file contains hidden or 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
module(load="omczmq") | |
template(name="PUBSUBTEST" type="list" option.json="on") { | |
property(name="hostname") | |
constant(value=".") | |
property(name="syslogtag" position.from="1" position.to="32") | |
constant(value="|") | |
property(name="msg") | |
} | |
This file contains hidden or 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
module(load="omczmq") | |
template(name="pubsub_host_tag" type="list" option.json="on") { | |
property(name="hostname") | |
constant(value=".") | |
property(name="syslogtag" position.from="1" position.to="32") | |
constant(value="|") | |
property(name="rawmsg") | |
} | |
This file contains hidden or 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
#include <czmq.h> | |
int | |
main (void) | |
{ | |
zsock_t *client = zsock_new (ZMQ_SUB); | |
assert (client); | |
zsock_set_subscribe (client, ""); | |
zcert_t *server_cert = zcert_load ("home/example_user/.cu |
This file contains hidden or 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 goczmq | |
import ( | |
"fmt" | |
) | |
func ExampleTraditionalRequestResponder() { | |
go func() { | |
responder := NewSock(Rep) | |
_, err := responder.Bind("inproc://traditional") |
This file contains hidden or 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 benchmarkLogtalez(size int, b *testing.B) { | |
endpoints := []string{"inproc://benchmark"} | |
topics := []string{""} | |
servercert := "./example_certs/example_curve_server_cert" | |
clientcert := "./example_certs/example_curve_client_cert" | |
go func() { | |
lt, err := New(endpoints, topics, servercert, clientcert) | |
if err != nil { | |
panic(err) |
This file contains hidden or 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 benchmarkChanneler(size int, b *testing.B) { | |
pullSock := NewSock(Pull) | |
pullSock.Bind("inproc://benchChan") | |
defer pullSock.Destroy() | |
channeler := NewChanneler(pullSock, false) | |
time.Sleep(10 * time.Millisecond) | |
go func() { | |
pushSock := NewSock(Push) |
This file contains hidden or 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 ( | |
"encoding/gob" | |
"fmt" | |
"github.com/zeromq/goczmq" | |
) | |
// person is an example type we will encode, send, and decode |
This file contains hidden or 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 goczmq | |
import ( | |
"sync" | |
"testing" | |
) | |
// WITHOUT MUTEX | |
type WithoutMutex struct { |
This file contains hidden or 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
go test -bench=. | |
testing: warning: no tests to run | |
PASS | |
BenchmarkSetGet 2000000000 0.61 ns/op | |
BenchmarkSetGetMutex 10000000 119 ns/op | |
ok github.com/taotetek/mutextest 2.622s |