godds

package module
v0.0.0-...-9449e14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2021 License: MIT Imports: 0 Imported by: 0

README

godds

A simple implementation of Data Distribution Service (DDS) in Go.

example

package main

import (
	"context"
	"fmt"
	"time"

	"github.com/suutaku/godds/pkg/node"
	"github.com/suutaku/godds/proto"
	gproto "google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/types/known/anypb"
)

func main() {
	ctx := context.Background()
	node := node.NewNode(ctx, "", "")
	var msg = proto.Version{}
	node.Subscribe(&msg, func(data *anypb.Any) {
		var rmsg = proto.Message{}
		anypb.UnmarshalTo(data, &rmsg, gproto.UnmarshalOptions{})
		fmt.Println(data)
	})
	node.Start()

	for {
		sub := proto.Version{Version: "0.0.1"}
		node.Publish(&sub)
		time.Sleep(1 * time.Second)
	}

}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
internal
cli
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL