Skip to content

Commit

Permalink
Create new bot version message types v1 (#25)
Browse files Browse the repository at this point in the history
* Added ActivityProductInfo message type
* Upgraded protocol version;  Replaced v1alpha with v1
* Version upgrade 9.0.0
* Enforced Request Types Grouping and order in code
* Changed compression tests to not contain the expected value expressed as bytes
* Extended Partner Plugin Examples
  • Loading branch information
VjeraTurk authored Sep 5, 2024
1 parent 2086097 commit c45fad8
Show file tree
Hide file tree
Showing 18 changed files with 716 additions and 383 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Camino-Messenger-Bot is designed to facilitate communication through various mes

This application depends on the [camino-messenger-protocol](https://github.com/chain4travel/camino-messenger-protocol), which is a separate repository. The protocol defines the protobuf messages and services used for communication between the gRPC server and client.

Currently [release-6](https://github.com/chain4travel/camino-messenger-protocol/releases/tag/release-6) of Camino Messenger Protocol is used.
Currently [release-9](https://github.com/chain4travel/camino-messenger-protocol/releases/tag/release-9) of Camino Messenger Protocol is used.

## Examples and Docker Support

Expand Down
15 changes: 8 additions & 7 deletions camino-messenger-bot-supplier.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,18 @@ partner_plugin_ca_file: ca-cert.pem

### Supported Request Types for this supplier.
supported_request_types:
- ActivitySearchRequest
- ActivityProductListRequest
- AccommodationProductInfoRequest
- AccommodationProductListRequest
- AccommodationSearchRequest
- GetNetworkFeeRequest
- GetPartnerConfigurationRequest
- MintRequest
- ValidationRequest
- PingRequest
- AccommodationProductListRequest
- AccommodationProductInfoRequest
- AccommodationSearchRequest
- ActivityProductListRequest
- ActivityProductInfoRequest
- ActivitySearchRequest
- TransportSearchRequest
- MintRequest
- ValidationRequest
- SeatMapRequest
- SeatMapAvailabilityRequest
- CountryEntryRequirementsRequest
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
CMB_PARTNER_PLUGIN_PORT: "50051"
CMB_PARTNER_PLUGIN_UNENCRYPTED: "true"
CMB_RESPONSE_TIMEOUT: "10000"
CMB_SUPPORTED_REQUEST_TYPES: "ActivitySearchRequest,AccommodationSearchRequest,GetNetworkFeeRequest,GetPartnerConfigurationRequest,PingRequest,TransportSearchRequest,MintRequest,ValidationRequest,SeatMapRequest,SeatMapAvailabilityRequest,CountryEntryRequirementsRequest"
CMB_SUPPORTED_REQUEST_TYPES: "GetNetworkFeeRequest,GetPartnerConfigurationRequest,PingRequest,AccommodationProductListRequest,AccommodationProductInfoRequest,AccommodationSearchRequest,ActivityProductListRequest,ActivityProductInfoRequest,ActivitySearchRequest,TransportSearchRequest,MintRequest,ValidationRequest,SeatMapRequest,SeatMapAvailabilityRequest,CountryEntryRequirementsRequest"
CMB_RPC_URL: "https://columbus.camino.network/ext/bc/C/rpc"
CMB_BOOKING_TOKEN_ABI_FILE: abi/BookingTokenV0.abi
CMB_SUPPLIER_NAME: SUPPLIER_NAME
Expand Down
22 changes: 11 additions & 11 deletions examples/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
"sync"
"time"

typesv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/types/v1alpha"
typesv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/types/v1"

"buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1alpha/accommodationv1alphagrpc"
accommodationv1alpha "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1alpha"
"buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/accommodation/v1/accommodationv1grpc"
accommodationv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v1"
internalmetadata "github.com/chain4travel/camino-messenger-bot/internal/metadata"
"go.uber.org/zap"
"google.golang.org/grpc"
Expand Down Expand Up @@ -72,17 +72,17 @@ func createClientAndRunRequest(i int, ppConfig config.PartnerPluginConfig, sLogg
fmt.Errorf("error starting client: %v", err)
return
}
request := &accommodationv1alpha.AccommodationSearchRequest{
request := &accommodationv1.AccommodationSearchRequest{
Header: nil,
SearchParametersGeneric: &typesv1alpha.SearchParameters{
Language: typesv1alpha.Language_LANGUAGE_UG,
SearchParametersGeneric: &typesv1.SearchParameters{
Language: typesv1.Language_LANGUAGE_UG,
Market: 1,
MaxOptions: 2,
},
Queries: []*accommodationv1alpha.AccommodationSearchQuery{
Queries: []*accommodationv1.AccommodationSearchQuery{
{
SearchParametersAccommodation: &accommodationv1alpha.AccommodationSearchParameters{
SupplierCodes: []*typesv1alpha.SupplierProductCode{{SupplierCode: "supplier1"}},
SearchParametersAccommodation: &accommodationv1.AccommodationSearchParameters{
SupplierCodes: []*typesv1.SupplierProductCode{{SupplierCode: "supplier1"}},
},
},
},
Expand All @@ -93,7 +93,7 @@ func createClientAndRunRequest(i int, ppConfig config.PartnerPluginConfig, sLogg
})
ctx := metadata.NewOutgoingContext(context.Background(), md)

ass := accommodationv1alphagrpc.NewAccommodationSearchServiceClient(c.ClientConn)
ass := accommodationv1grpc.NewAccommodationSearchServiceClient(c.ClientConn)
begin := time.Now()
var header metadata.MD
resp, err := ass.AccommodationSearch(ctx, request, grpc.Header(&header))
Expand All @@ -114,7 +114,7 @@ func createClientAndRunRequest(i int, ppConfig config.PartnerPluginConfig, sLogg
c.Shutdown()
}

func addToDataset(counter int64, totalTime int64, resp *accommodationv1alpha.AccommodationSearchResponse, metadata *internalmetadata.Metadata, loadTestData [][]string, mu sync.Mutex) {
func addToDataset(counter int64, totalTime int64, resp *accommodationv1.AccommodationSearchResponse, metadata *internalmetadata.Metadata, loadTestData [][]string, mu sync.Mutex) {
var data []string
var entries []struct {
Key string
Expand Down
Loading

0 comments on commit c45fad8

Please sign in to comment.