From 81900486cc7275e8481f969bb017a393d8e1d285 Mon Sep 17 00:00:00 2001 From: jcollins-axway Date: Thu, 18 Jul 2019 09:20:20 -0700 Subject: [PATCH 1/6] STOMP-1045 - update timeKey to @timestamp --- util/logging/logging.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/util/logging/logging.go b/util/logging/logging.go index c82c4b3..2611b76 100644 --- a/util/logging/logging.go +++ b/util/logging/logging.go @@ -25,13 +25,13 @@ func init() { "outputPaths": ["stdout"], "errorOutputPaths": ["stderr"], "encoderConfig": { - "messageKey": "msg", - "levelKey": "level", - "levelEncoder": "capital", - "timeKey": "time", - "timeEncoder": "iso8601" + "messageKey": "msg", + "levelKey": "level", + "levelEncoder": "capital", + "timeKey": "@timestamp", + "timeEncoder": "iso8601" } - }`) + }`) var cfg zap.Config if err = json.Unmarshal(rawJSON, &cfg); err != nil { From d82775ec6f19ec3d3ce11f107c78f08d2e6525d8 Mon Sep 17 00:00:00 2001 From: dfeldick Date: Fri, 26 Jul 2019 14:42:45 -0700 Subject: [PATCH 2/6] STOMP-831 - remove "errors unhandled" from gosec --- Jenkinsfile-gosec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile-gosec b/Jenkinsfile-gosec index d62f3a2..32159df 100644 --- a/Jenkinsfile-gosec +++ b/Jenkinsfile-gosec @@ -15,7 +15,7 @@ pipeline { ln -s ${WORKSPACE} ace-golang-sdk cd $GOPATH/src/github.com/Axway/ace-golang-sdk dep ensure -v - gosec -severity medium -fmt=json -out=$GOPATH/src/github.com/Axway/ace-golang-sdk/gosec-results.json ./... + gosec -exclude=G104 -severity medium -fmt=json -out=$GOPATH/src/github.com/Axway/ace-golang-sdk/gosec-results.json ./... ''' } } From c55c9d56181448ca6b3f6358498fb51b84d90e9a Mon Sep 17 00:00:00 2001 From: jcollins-axway Date: Mon, 29 Jul 2019 12:37:49 -0700 Subject: [PATCH 3/6] STOMP-1077 - support adding config parameters in GoLang SDK --- linker/linker.go | 57 +++++++-- linker/linker_test.go | 69 +++++++++++ rpc/ace.pb.go | 260 +++++++++++++++++++++++++++++------------- 3 files changed, 302 insertions(+), 84 deletions(-) diff --git a/linker/linker.go b/linker/linker.go index f191b03..4a3bca1 100644 --- a/linker/linker.go +++ b/linker/linker.go @@ -3,6 +3,7 @@ package linker import ( "context" "fmt" + "strconv" "go.uber.org/zap" @@ -60,6 +61,7 @@ type Link struct { var link *Link var traceLogging tracing.TraceLogging var log = logging.Logger() +var serviceConfigParamTemplates []*rpc.ConfigParameter // MsgProducer - what is exposed to client business function type MsgProducer interface { @@ -69,6 +71,47 @@ type MsgProducer interface { // BusinessMessageProcessor type of 'business' function used to process paylod relayed to Linker type BusinessMessageProcessor func(context.Context, []*messaging.BusinessMessage, MsgProducer) error +// Add config parameter to list +func addConfigParam(configParam *rpc.ConfigParameter) { + serviceConfigParamTemplates = append(serviceConfigParamTemplates, configParam) +} + +// AddStringConfigParam - Add String config parameter for the service +func AddStringConfigParam(name, defaultValue string, required bool) error { + stringConfigParam := &rpc.ConfigParameter{ + Name: name, + Type: "string", + DefaultValue: defaultValue, + IsRequired: required, + } + addConfigParam(stringConfigParam) + return nil +} + +// AddIntConfigParam - Add integer config parameter for the service +func AddIntConfigParam(name string, defaultValue int, required bool) error { + intConfigParam := &rpc.ConfigParameter{ + Name: name, + Type: "int", + DefaultValue: strconv.Itoa(defaultValue), + IsRequired: required, + } + addConfigParam(intConfigParam) + return nil +} + +// AddBooleanConfigParam - Add boolean config parameter for the service +func AddBooleanConfigParam(name string, defaultValue bool) error { + intConfigParam := &rpc.ConfigParameter{ + Name: name, + Type: "boolean", + DefaultValue: strconv.FormatBool(defaultValue), + IsRequired: true, + } + addConfigParam(intConfigParam) + return nil +} + // Register -Registers the business service with linker func Register(name, version, description, serviceType string, fn BusinessMessageProcessor) (*Link, error) { if link != nil { @@ -167,7 +210,6 @@ func (link Link) OnRelay(aceMessage *rpc.Message) { panic(fmt.Sprintf("MsgProcessor of %s agent is not of expected BusinessMessageProcessor type, actual: %T\n", link.name, msgProcessor)) } - } // OnSidecarRegistrationComplete can perform Linker-specific post registration actions @@ -238,12 +280,13 @@ func (link Link) onRelayComplete(msg *rpc.Message) { func (link Link) registerWithSidecar() (bool, error) { serviceInfo := rpc.ServiceInfo{ - ServiceName: link.name, - ServiceVersion: link.version, - ServiceDescription: link.description, - ServiceType: rpc.ServiceInfo_ServiceType(rpc.ServiceInfo_ServiceType_value[link.serviceType]), - ServiceHost: link.cfg.ServerHost, - ServicePort: uint32(link.cfg.ServerPort), + ServiceName: link.name, + ServiceVersion: link.version, + ServiceDescription: link.description, + ServiceType: rpc.ServiceInfo_ServiceType(rpc.ServiceInfo_ServiceType_value[link.serviceType]), + ServiceHost: link.cfg.ServerHost, + ServicePort: uint32(link.cfg.ServerPort), + ServiceConfigTemplate: serviceConfigParamTemplates, } log.Info("Registering with sidecar", diff --git a/linker/linker_test.go b/linker/linker_test.go index c791630..d82eca1 100644 --- a/linker/linker_test.go +++ b/linker/linker_test.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "io" + "strconv" "testing" "github.com/Axway/ace-golang-sdk/linker/rpcclient" @@ -47,6 +48,74 @@ func TestRegister(t *testing.T) { } } +func TestAddParams(t *testing.T) { + AddStringConfigParam("string", "default", false) + + if len(serviceConfigParamTemplates) != 1 { + t.Errorf("incorrect number of parameters, expected %s got %s", "1", strconv.Itoa(len(serviceConfigParamTemplates))) + } + + if serviceConfigParamTemplates[0].GetType() != "string" { + t.Errorf("incorrect type of string parameter, expected %s got %s", "string", serviceConfigParamTemplates[0].GetType()) + } + + if serviceConfigParamTemplates[0].GetName() != "string" { + t.Errorf("incorrect name of string parameter, expected %s got %s", "string", serviceConfigParamTemplates[0].GetName()) + } + + if serviceConfigParamTemplates[0].GetDefaultValue() != "default" { + t.Errorf("incorrect default value of string parameter, expected %s got %s", "default", serviceConfigParamTemplates[0].GetDefaultValue()) + } + + if serviceConfigParamTemplates[0].GetIsRequired() != false { + t.Errorf("incorrect IsRequired of string parameter, expected %s got %s", "false", strconv.FormatBool(serviceConfigParamTemplates[0].GetIsRequired())) + } + + AddIntConfigParam("integer", 123, true) + + if len(serviceConfigParamTemplates) != 2 { + t.Errorf("incorrect number of parameters, expected %s got %s", "2", strconv.Itoa(len(serviceConfigParamTemplates))) + } + + if serviceConfigParamTemplates[1].GetType() != "int" { + t.Errorf("incorrect type of integer parameter, expected %s got %s", "int", serviceConfigParamTemplates[1].GetType()) + } + + if serviceConfigParamTemplates[1].GetName() != "integer" { + t.Errorf("incorrect name of integer parameter, expected %s got %s", "integer", serviceConfigParamTemplates[1].GetName()) + } + + if serviceConfigParamTemplates[1].GetDefaultValue() != "123" { + t.Errorf("incorrect default value of integer parameter, expected %s got %s", "123", serviceConfigParamTemplates[1].GetDefaultValue()) + } + + if serviceConfigParamTemplates[1].GetIsRequired() != true { + t.Errorf("incorrect IsRequired of integer parameter, expected %s got %s", "true", strconv.FormatBool(serviceConfigParamTemplates[1].GetIsRequired())) + } + + AddBooleanConfigParam("boolean", false) + + if len(serviceConfigParamTemplates) != 3 { + t.Errorf("incorrect number of parameters, expected %s got %s", "3", strconv.Itoa(len(serviceConfigParamTemplates))) + } + + if serviceConfigParamTemplates[2].GetType() != "boolean" { + t.Errorf("incorrect type of boolean parameter, expected %s got %s", "boolean", serviceConfigParamTemplates[2].GetType()) + } + + if serviceConfigParamTemplates[2].GetName() != "boolean" { + t.Errorf("incorrect name of boolean parameter, expected %s got %s", "boolean", serviceConfigParamTemplates[2].GetName()) + } + + if serviceConfigParamTemplates[2].GetDefaultValue() != "false" { + t.Errorf("incorrect default value of boolean parameter, expected %s got %s", "false", serviceConfigParamTemplates[2].GetDefaultValue()) + } + + if serviceConfigParamTemplates[2].GetIsRequired() != true { + t.Errorf("incorrect IsRequired of boolean parameter, expected %s got %s", "true", strconv.FormatBool(serviceConfigParamTemplates[2].GetIsRequired())) + } +} + type mockClient struct { buildClientRelayCalled bool clientRegisterCalled bool diff --git a/rpc/ace.pb.go b/rpc/ace.pb.go index acc2f92..1bdc78e 100644 --- a/rpc/ace.pb.go +++ b/rpc/ace.pb.go @@ -8,12 +8,13 @@ package rpc import ( context "context" fmt "fmt" + math "math" + messaging "github.com/Axway/ace-golang-sdk/messaging" proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -49,7 +50,7 @@ func (x ServiceInfo_ServiceType) String() string { } func (ServiceInfo_ServiceType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_671d051cacda6b9d, []int{0, 0} + return fileDescriptor_671d051cacda6b9d, []int{1, 0} } type Message_ErrorType int32 @@ -77,27 +78,100 @@ func (x Message_ErrorType) String() string { } func (Message_ErrorType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_671d051cacda6b9d, []int{1, 0} + return fileDescriptor_671d051cacda6b9d, []int{2, 0} +} + +// Service Config Parameter Template +type ConfigParameter struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + DefaultValue string `protobuf:"bytes,4,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + IsRequired bool `protobuf:"varint,5,opt,name=is_required,json=isRequired,proto3" json:"is_required,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConfigParameter) Reset() { *m = ConfigParameter{} } +func (m *ConfigParameter) String() string { return proto.CompactTextString(m) } +func (*ConfigParameter) ProtoMessage() {} +func (*ConfigParameter) Descriptor() ([]byte, []int) { + return fileDescriptor_671d051cacda6b9d, []int{0} +} + +func (m *ConfigParameter) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConfigParameter.Unmarshal(m, b) +} +func (m *ConfigParameter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConfigParameter.Marshal(b, m, deterministic) +} +func (m *ConfigParameter) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfigParameter.Merge(m, src) +} +func (m *ConfigParameter) XXX_Size() int { + return xxx_messageInfo_ConfigParameter.Size(m) +} +func (m *ConfigParameter) XXX_DiscardUnknown() { + xxx_messageInfo_ConfigParameter.DiscardUnknown(m) +} + +var xxx_messageInfo_ConfigParameter proto.InternalMessageInfo + +func (m *ConfigParameter) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ConfigParameter) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *ConfigParameter) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func (m *ConfigParameter) GetDefaultValue() string { + if m != nil { + return m.DefaultValue + } + return "" +} + +func (m *ConfigParameter) GetIsRequired() bool { + if m != nil { + return m.IsRequired + } + return false } // Service info specified in business logic and passed to sidecar for registration. type ServiceInfo struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` - ServiceVersion string `protobuf:"bytes,2,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"` - ServiceType ServiceInfo_ServiceType `protobuf:"varint,3,opt,name=service_type,json=serviceType,proto3,enum=rpc.ServiceInfo_ServiceType" json:"service_type,omitempty"` - ServiceDescription string `protobuf:"bytes,4,opt,name=service_description,json=serviceDescription,proto3" json:"service_description,omitempty"` - ServiceHost string `protobuf:"bytes,5,opt,name=service_host,json=serviceHost,proto3" json:"service_host,omitempty"` - ServicePort uint32 `protobuf:"varint,6,opt,name=service_port,json=servicePort,proto3" json:"service_port,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + ServiceVersion string `protobuf:"bytes,2,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"` + ServiceType ServiceInfo_ServiceType `protobuf:"varint,3,opt,name=service_type,json=serviceType,proto3,enum=rpc.ServiceInfo_ServiceType" json:"service_type,omitempty"` + ServiceDescription string `protobuf:"bytes,4,opt,name=service_description,json=serviceDescription,proto3" json:"service_description,omitempty"` + ServiceHost string `protobuf:"bytes,5,opt,name=service_host,json=serviceHost,proto3" json:"service_host,omitempty"` + ServicePort uint32 `protobuf:"varint,6,opt,name=service_port,json=servicePort,proto3" json:"service_port,omitempty"` + ServiceConfigTemplate []*ConfigParameter `protobuf:"bytes,7,rep,name=service_config_template,json=serviceConfigTemplate,proto3" json:"service_config_template,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ServiceInfo) Reset() { *m = ServiceInfo{} } func (m *ServiceInfo) String() string { return proto.CompactTextString(m) } func (*ServiceInfo) ProtoMessage() {} func (*ServiceInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_671d051cacda6b9d, []int{0} + return fileDescriptor_671d051cacda6b9d, []int{1} } func (m *ServiceInfo) XXX_Unmarshal(b []byte) error { @@ -160,6 +234,13 @@ func (m *ServiceInfo) GetServicePort() uint32 { return 0 } +func (m *ServiceInfo) GetServiceConfigTemplate() []*ConfigParameter { + if m != nil { + return m.ServiceConfigTemplate + } + return nil +} + // Root structure for all STOMP messages. type Message struct { // Unique ID of the message containing this payload. @@ -190,7 +271,7 @@ func (m *Message) Reset() { *m = Message{} } func (m *Message) String() string { return proto.CompactTextString(m) } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_671d051cacda6b9d, []int{1} + return fileDescriptor_671d051cacda6b9d, []int{2} } func (m *Message) XXX_Unmarshal(b []byte) error { @@ -310,25 +391,27 @@ func (m *Message) GetBusinessMessage() []*messaging.BusinessMessage { } type StepPattern struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Address of the name and version of the service this message is intended for. - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` - ServiceVersion string `protobuf:"bytes,2,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"` + ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + ServiceVersion string `protobuf:"bytes,3,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"` // Placeholder fields for payload transformation, routing, and validation. - Validation string `protobuf:"bytes,3,opt,name=validation,proto3" json:"validation,omitempty"` - Evaluation string `protobuf:"bytes,4,opt,name=evaluation,proto3" json:"evaluation,omitempty"` - Transformation string `protobuf:"bytes,5,opt,name=transformation,proto3" json:"transformation,omitempty"` + Validation string `protobuf:"bytes,4,opt,name=validation,proto3" json:"validation,omitempty"` + Evaluation string `protobuf:"bytes,5,opt,name=evaluation,proto3" json:"evaluation,omitempty"` + Transformation string `protobuf:"bytes,6,opt,name=transformation,proto3" json:"transformation,omitempty"` // Recursion of StepPattern to provide the overall structure of the choreography. - Child []*StepPattern `protobuf:"bytes,6,rep,name=child,proto3" json:"child,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Child []*StepPattern `protobuf:"bytes,7,rep,name=child,proto3" json:"child,omitempty"` + ServiceConfig []*ConfigParameter `protobuf:"bytes,8,rep,name=service_config,json=serviceConfig,proto3" json:"service_config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *StepPattern) Reset() { *m = StepPattern{} } func (m *StepPattern) String() string { return proto.CompactTextString(m) } func (*StepPattern) ProtoMessage() {} func (*StepPattern) Descriptor() ([]byte, []int) { - return fileDescriptor_671d051cacda6b9d, []int{2} + return fileDescriptor_671d051cacda6b9d, []int{3} } func (m *StepPattern) XXX_Unmarshal(b []byte) error { @@ -349,6 +432,13 @@ func (m *StepPattern) XXX_DiscardUnknown() { var xxx_messageInfo_StepPattern proto.InternalMessageInfo +func (m *StepPattern) GetId() string { + if m != nil { + return m.Id + } + return "" +} + func (m *StepPattern) GetServiceName() string { if m != nil { return m.ServiceName @@ -391,6 +481,13 @@ func (m *StepPattern) GetChild() []*StepPattern { return nil } +func (m *StepPattern) GetServiceConfig() []*ConfigParameter { + if m != nil { + return m.ServiceConfig + } + return nil +} + // Simple confirmation structure for RPC calls. type Receipt struct { IsOk bool `protobuf:"varint,1,opt,name=is_ok,json=isOk,proto3" json:"is_ok,omitempty"` @@ -404,7 +501,7 @@ func (m *Receipt) Reset() { *m = Receipt{} } func (m *Receipt) String() string { return proto.CompactTextString(m) } func (*Receipt) ProtoMessage() {} func (*Receipt) Descriptor() ([]byte, []int) { - return fileDescriptor_671d051cacda6b9d, []int{3} + return fileDescriptor_671d051cacda6b9d, []int{4} } func (m *Receipt) XXX_Unmarshal(b []byte) error { @@ -442,6 +539,7 @@ func (m *Receipt) GetError() string { func init() { proto.RegisterEnum("rpc.ServiceInfo_ServiceType", ServiceInfo_ServiceType_name, ServiceInfo_ServiceType_value) proto.RegisterEnum("rpc.Message_ErrorType", Message_ErrorType_name, Message_ErrorType_value) + proto.RegisterType((*ConfigParameter)(nil), "rpc.ConfigParameter") proto.RegisterType((*ServiceInfo)(nil), "rpc.ServiceInfo") proto.RegisterType((*Message)(nil), "rpc.Message") proto.RegisterMapType((map[string]string)(nil), "rpc.Message.MetaDataEntry") @@ -452,58 +550,66 @@ func init() { func init() { proto.RegisterFile("ace.proto", fileDescriptor_671d051cacda6b9d) } var fileDescriptor_671d051cacda6b9d = []byte{ - // 812 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x5d, 0x73, 0xe3, 0x34, - 0x14, 0xad, 0x9b, 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xf9, 0xee, 0x6f, 0xb9, 0x54, 0x5e, - 0xe9, 0x51, 0xf7, 0x17, 0x5c, 0xaa, 0xbc, 0x24, 0xe1, 0x42, 0x79, 0xe5, 0xb6, 0xd3, 0x6d, 0xee, - 0x24, 0x13, 0x2e, 0x54, 0xe7, 0xd5, 0xce, 0x12, 0xd3, 0x05, 0x40, 0x79, 0xdc, 0x9f, 0x8d, 0xde, - 0x0c, 0xdd, 0x3d, 0x72, 0x00, 0xf5, 0xfe, 0xf9, 0xb9, 0x3f, 0x3c, 0xef, 0xcf, 0x46, 0x57, 0x63, - 0xd7, 0xe9, 0xfc, 0x53, 0x82, 0xca, 0x25, 0x4a, 0x49, 0x97, 0x48, 0x08, 0x14, 0xaf, 0xaf, 0x47, - 0x83, 0xd4, 0x33, 0xb3, 0x26, 0x9f, 0x42, 0x3d, 0xa1, 0x02, 0x99, 0x0a, 0x0c, 0x65, 0x8d, 0x02, - 0x0b, 0x19, 0xc1, 0x0b, 0x68, 0x4a, 0xfc, 0x63, 0x83, 0x4c, 0xbb, 0x84, 0x22, 0x36, 0x2e, 0x15, - 0xfd, 0x46, 0x06, 0xce, 0x50, 0xc4, 0xe4, 0x18, 0x9e, 0xef, 0x44, 0x9b, 0x24, 0x41, 0x11, 0xcc, - 0xf9, 0x86, 0x2d, 0x8c, 0x13, 0x45, 0xed, 0x84, 0xe5, 0xae, 0x35, 0x75, 0xaa, 0x19, 0xf2, 0x21, - 0x54, 0xcf, 0x2e, 0xc6, 0xb6, 0xa8, 0x75, 0xa1, 0x72, 0x76, 0x31, 0x36, 0x15, 0x0d, 0xf5, 0xd6, - 0x52, 0xe5, 0x8c, 0x7a, 0x6b, 0xa8, 0x57, 0x50, 0x49, 0xa8, 0x52, 0x28, 0x98, 0x57, 0x69, 0x3b, - 0xdd, 0xfa, 0x89, 0x6b, 0x87, 0xa5, 0x30, 0x99, 0x58, 0xdc, 0xcf, 0x04, 0xe4, 0x63, 0x00, 0xc5, - 0x93, 0x28, 0xb4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 0xcb, - 0x4e, 0xab, 0xfd, 0x10, 0x27, 0xfa, 0xc5, 0x9e, 0x38, 0xbf, 0xbf, 0x58, 0x46, 0xea, 0x76, 0x33, - 0xef, 0x85, 0x3c, 0x3e, 0xea, 0x6b, 0xe5, 0x11, 0x0d, 0xf1, 0xf5, 0x92, 0xaf, 0x29, 0x5b, 0xbe, - 0x96, 0x8b, 0xd5, 0x91, 0x48, 0xc2, 0xbf, 0x9c, 0xbd, 0x79, 0xd9, 0x3c, 0xf1, 0xdf, 0xfc, 0x17, - 0x00, 0x00, 0xff, 0xff, 0x4e, 0xa4, 0x67, 0xc8, 0x04, 0x06, 0x00, 0x00, + // 940 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xd9, 0x6e, 0x23, 0x45, + 0x14, 0x4d, 0x7b, 0x89, 0xed, 0xeb, 0x25, 0xa6, 0x26, 0x03, 0x4d, 0xc4, 0x12, 0x1c, 0x31, 0x98, + 0x41, 0xe3, 0x84, 0x00, 0x02, 0x31, 0x0f, 0x28, 0xb1, 0xad, 0xc4, 0x62, 0xe2, 0x58, 0x6d, 0x27, + 0x1a, 0x78, 0x69, 0x95, 0xbb, 0xaf, 0x9d, 0x92, 0xdd, 0xcb, 0x54, 0x95, 0xc3, 0xf8, 0x0f, 0x90, + 0x78, 0xe6, 0x57, 0xf8, 0x00, 0xbe, 0x0c, 0x55, 0x55, 0xb7, 0xd3, 0xce, 0x20, 0xc4, 0x5b, 0xd5, + 0x39, 0xa7, 0xeb, 0x6e, 0x47, 0xb7, 0xa1, 0x42, 0x3d, 0xec, 0xc4, 0x3c, 0x92, 0x11, 0xc9, 0xf3, + 0xd8, 0x3b, 0x68, 0x4c, 0x57, 0x82, 0x85, 0x28, 0x84, 0x01, 0x5b, 0x7f, 0x5a, 0xb0, 0xd7, 0x8d, + 0xc2, 0x19, 0x9b, 0x8f, 0x28, 0xa7, 0x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25, 0x5d, 0x93, 0x5a, 0xd6, 0xbb, 0x8f, 0x65, 0x6d, 0xeb, 0xc4, 0x3a, 0xff, 0x19, 0x9e, + 0x7a, 0x51, 0xd0, 0xa1, 0x6f, 0x7f, 0xa3, 0xeb, 0x8e, 0xfa, 0xdb, 0x09, 0x7f, 0xa1, 0x64, 0xe7, + 0xe5, 0x33, 0x0f, 0x47, 0xea, 0x27, 0x37, 0xb2, 0x7e, 0x3d, 0x9a, 0x33, 0x79, 0xb7, 0x9a, 0x76, + 0xbc, 0x28, 0x38, 0x3e, 0x53, 0xca, 0x63, 0xea, 0xe1, 0x8b, 0x79, 0xb4, 0xa4, 0xe1, 0xfc, 0x85, + 0xf0, 0x17, 0xc7, 0x3c, 0xf6, 0x7e, 0xb7, 0x76, 0xa6, 0xbb, 0xfa, 0xaf, 0xf8, 0xcd, 0x3f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0xd6, 0xfd, 0x2e, 0x7f, 0x37, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From 641dc1a940948c6a00fe7153afb5b861c8d2d33e Mon Sep 17 00:00:00 2001 From: jcollins-axway Date: Mon, 29 Jul 2019 13:26:52 -0700 Subject: [PATCH 4/6] STOMP-1077 - update README to include adding the config parameters --- README.md | 92 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 62 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 7f650bb..df5397a 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,15 @@ ACE SDK allows developers to implement microservices that can be used as executable step in a choreography. # Service Implemenation and Using the SDK + ## Implement the callback method ### The callback method signature + Implement the callback method that will process the received message. Below is the signature of the method ``` - func businessMessageProcessor(ctx context.Context, businessMsg *messaging.BusinessMessage, msgProducer linker.MsgProducer) error +func businessMessageProcessor(ctx context.Context, businessMsg *messaging.BusinessMessage, msgProducer linker.MsgProducer) error ``` ### Input processing @@ -27,41 +29,49 @@ The payload [type messaging.Payload] can be actual payload (use messaging.Payloa The metadata can be retrieved using the interface method GetMetaData() on businessMsg object which returns map of string key/value pairs identifying the metadata associated with the payload. ### Output processing + The output of the processing can be responded by generating new message(s). To create a new message construct business message and setup metadata. The new message can then be produced using clientRelay parameter. #### Creating new ACE business message -- Construct the metadata - Constructing the metadata is done by setting up a map of string key/value pairs +- Construct the metadata + + Constructing the metadata is done by setting up a map of string key/value pairs + +- Contruct the payload + + Create the payload with content as demonstrated below. The newContent in the example below is a byte array holding the raw content -- Contruct the payload + ``` + newPayload := messaging.Payload{Body: newContent} + ``` - Create the payload with content as demonstrated below. The newContent in the example below is a byte array holding the raw content - ``` - newPayload := messaging.Payload{Body: newContent} - ``` + OR - OR + Create the payload with location reference as demonstrated below. The newContent in the example below is a byte array holding the the location reference. - Create the payload with location reference as demonstrated below. The newContent in the example below is a byte array holding the the location reference. - ``` - newPayload := messaging.Payload{Body: newContent, LocationReference: true} - ``` + ``` + newPayload := messaging.Payload{Body: newContent, LocationReference: true} + ``` -- Construct the ACE business message +- Construct the ACE business message - Create new business message object as demonstrated below. The "newMetadata" and "newPayload" in the example below identifies the metadata and payload for the new business message - ``` - newBusinessMsg := messaging.BusinessMessage{ MetaData: newMetadata, Payload: &newPayload} - ``` + Create new business message object as demonstrated below. The "newMetadata" and "newPayload" in the example below identifies the metadata and payload for the new business message + + ``` + newBusinessMsg := messaging.BusinessMessage{ MetaData: newMetadata, Payload: &newPayload} + ``` #### Producing message + To produce messages use the Send method on msgProducer parameter as demostrated below + ``` - msgProducer.Send(&newBusinessMsg) +msgProducer.Send(&newBusinessMsg) ``` ## Add trace for service execution (Optional) + ACE SDK has instrumentation for OpenTracing(https://opentracing.io/specification/) built-in and provides ability to allow the business service to inject the tracing spans. To start a span as child of span managed by ACE, use StartSpanFromContext method from opentracing package. Using the created span the business service can log details as demonstrated below. @@ -73,39 +83,61 @@ span.Finish() ``` ## Handling errors in the service execution + ACE SDK had three error types defined. SendingError - Can be returned from calling send method on the MsgProducer. + ``` - error := msgProducer.Send(&newBusinessMsg) +error := msgProducer.Send(&newBusinessMsg) ``` ProcessingError - Returned by the BusinessMessageProcessor. + ``` - return linker.NewProcessingError(fmt.Errorf("processing error)")) +return linker.NewProcessingError(fmt.Errorf("processing error)")) ``` SystemError - Returned by the BusinessMessageProcessor to clientRelay. + ``` - return linker.NewSystemError(fmt.Errorf("system error)")) +return linker.NewSystemError(fmt.Errorf("system error)")) ``` ## Register the service callback method with ACE + ACE business service must register the service info and callback method for making it usable as a step to build choreographies The service registration needs following details -- Service Name -- Service Version -- Service Description -- Callback method + +- Service Name +- Service Version +- Service Description +- Callback method + +The business service may also define config parameters to be used when using the service in a choreography. These +parameters need to be added prior to registering the callback method + +``` +# String Parmeters (name, default value, isRequired) +AddStringConfigParam("parameterName", "defaultValue", true) + +# Integer Parmeters (name, default value, isRequired) +AddIntConfigParam("parameterName", 123, false) + +# Boolean Parmeters (name, default value) +AddBooleanConfigParam("parameterName", false) +``` Below is an example of Registering the service info & callback method and then starting the ACE processing + ``` -aceAgent, err := linker.Register(serviceName, serviceVersion, serviceDescription, businessMessageProcessor) +aceAgent, err := linker.Register(serviceName, serviceVersion, serviceDescription, serviceType, businessMessageProcessor) aceAgent.Start() ``` The provided template reads the serviceName, serviceVersion and serviceDescription from following environment variables respectively, but its the implemenation choice on how to setup these details. -- SERVICE_NAME -- SERVICE_VERSION -- SERVICE_DESCRIPTION + +- SERVICE_NAME +- SERVICE_VERSION +- SERVICE_DESCRIPTION From 12db1b25a75a5db8229601c3f952f6cf1d0daa57 Mon Sep 17 00:00:00 2001 From: jcollins-axway Date: Mon, 29 Jul 2019 14:39:56 -0700 Subject: [PATCH 5/6] STOMP-1077 - fix name of object in AddBooleanConfigParam --- linker/linker.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linker/linker.go b/linker/linker.go index 4a3bca1..13d9794 100644 --- a/linker/linker.go +++ b/linker/linker.go @@ -102,13 +102,13 @@ func AddIntConfigParam(name string, defaultValue int, required bool) error { // AddBooleanConfigParam - Add boolean config parameter for the service func AddBooleanConfigParam(name string, defaultValue bool) error { - intConfigParam := &rpc.ConfigParameter{ + boolConfigParam := &rpc.ConfigParameter{ Name: name, Type: "boolean", DefaultValue: strconv.FormatBool(defaultValue), IsRequired: true, } - addConfigParam(intConfigParam) + addConfigParam(boolConfigParam) return nil } From 16510f6858b1a82ff6407432116233462d8a2bd9 Mon Sep 17 00:00:00 2001 From: Vivek Chauhan Date: Tue, 30 Jul 2019 14:37:02 -0700 Subject: [PATCH 6/6] INT - Added duplicate check on adding config param --- linker/linker.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/linker/linker.go b/linker/linker.go index 13d9794..3de9692 100644 --- a/linker/linker.go +++ b/linker/linker.go @@ -76,8 +76,21 @@ func addConfigParam(configParam *rpc.ConfigParameter) { serviceConfigParamTemplates = append(serviceConfigParamTemplates, configParam) } +func checkDuplicateConfigParam(name string) error { + for _, cfgParam := range serviceConfigParamTemplates { + if cfgParam.Name == name { + return fmt.Errorf("Duplicate definition for config parameter : %s", name) + } + } + return nil +} + // AddStringConfigParam - Add String config parameter for the service func AddStringConfigParam(name, defaultValue string, required bool) error { + err := checkDuplicateConfigParam(name) + if err != nil { + return err + } stringConfigParam := &rpc.ConfigParameter{ Name: name, Type: "string", @@ -90,6 +103,10 @@ func AddStringConfigParam(name, defaultValue string, required bool) error { // AddIntConfigParam - Add integer config parameter for the service func AddIntConfigParam(name string, defaultValue int, required bool) error { + err := checkDuplicateConfigParam(name) + if err != nil { + return err + } intConfigParam := &rpc.ConfigParameter{ Name: name, Type: "int", @@ -102,6 +119,10 @@ func AddIntConfigParam(name string, defaultValue int, required bool) error { // AddBooleanConfigParam - Add boolean config parameter for the service func AddBooleanConfigParam(name string, defaultValue bool) error { + err := checkDuplicateConfigParam(name) + if err != nil { + return err + } boolConfigParam := &rpc.ConfigParameter{ Name: name, Type: "boolean",