Skip to content

Commit

Permalink
Rename callout to http-grpc-callout
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanperry1 committed Nov 15, 2023
1 parent d6e73fc commit faccc94
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 22 deletions.
11 changes: 0 additions & 11 deletions samples/device-simulator/.gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
bin
.vscode/*
/mako
dns.yaml
/src/**/config.json
/bin
/listen
/mqtt
/manager
/simulator
dist/
cover.tmp.out
coverage.out
web
cover.*
12 changes: 9 additions & 3 deletions samples/device-simulator/lib/external/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ func (builder *DeviceSimulatorBuilder) ParseTopicAndPublisher(
)
}

func (builder *DeviceSimulatorBuilder) ParseTags(configuration Site) ([]string, error) {
func (builder *DeviceSimulatorBuilder) ParseTags(
configuration Site,
) ([]string, error) {
switch configuration.PayloadFormat {
case "JSONTagPerMessage":
return builder.ParseJSONTagPerMessage(configuration)
Expand All @@ -251,7 +253,9 @@ func (builder *DeviceSimulatorBuilder) ParseTags(configuration Site) ([]string,
}
}

func (builder *DeviceSimulatorBuilder) ParseAssets(configuration Site) ([]string, error) {
func (builder *DeviceSimulatorBuilder) ParseAssets(
configuration Site,
) ([]string, error) {
assets := make([]string, configuration.AssetCount)
for count := 0; count < configuration.AssetCount; count++ {
asset, err := builder.ParseAsset(configuration, count)
Expand Down Expand Up @@ -362,7 +366,9 @@ func (builder *DeviceSimulatorBuilder) ParseJSONTag(
return tagID, nil
}

func (builder *DeviceSimulatorBuilder) ParseOPCUA(configuration Site) ([]string, error) {
func (builder *DeviceSimulatorBuilder) ParseOPCUA(
configuration Site,
) ([]string, error) {
err := builder.ParseFormatter(
configuration.Name,
formatter.JSON,
Expand Down
4 changes: 4 additions & 0 deletions samples/http-grpc-callout/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/bin
cover.tmp.out
coverage.out
cover.*
6 changes: 3 additions & 3 deletions samples/http-grpc-callout/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21-cbl-mariner2.0 AS build

COPY ./lib /workdir/lib

COPY ./samples/callout /workdir/samples/callout
COPY ./samples/http-grpc-callout /workdir/samples/http-grpc-callout

WORKDIR /workdir/samples/callout
WORKDIR /workdir/samples/http-grpc-callout

RUN go mod download

RUN go install github.com/magefile/mage@latest

RUN mage ci

RUN go build -o ./bin/callout ./cmd/callout
RUN go build -o ./bin/http-grpc-callout ./cmd/http-grpc-callout

EXPOSE 2112

Expand Down
10 changes: 7 additions & 3 deletions samples/http-grpc-callout/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@ func run() error {
grpcOutputs[index] = o
}

messageServer := NewGRPCMessageServer(grpcOutputs, &proto.ProtoEncoder{}, func(gs *GRPCMessageServer) {
gs.Logger = lg.Tag("server").Tag("grpc")
})
messageServer := NewGRPCMessageServer(
grpcOutputs,
&proto.ProtoEncoder{},
func(gs *GRPCMessageServer) {
gs.Logger = lg.Tag("server").Tag("grpc")
},
)
grpcServer := grpc.NewServer()
proto.RegisterSenderServer(grpcServer, messageServer)

Expand Down
2 changes: 1 addition & 1 deletion samples/http-grpc-callout/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/explore-iot-ops/samples/callout
module github.com/explore-iot-ops/samples/http-grpc-callout

go 1.21.3

Expand Down
2 changes: 1 addition & 1 deletion samples/http-grpc-callout/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

func CI() error {
return mage.CI(
"github.com/explore-iot-ops/samples/callout/",
"github.com/explore-iot-ops/samples/http-grpc-callout/",
map[string]any{"cmd": nil},
3000,
0.00,
Expand Down

0 comments on commit faccc94

Please sign in to comment.