diff --git a/internal/drivers/brokerdriver/producer.go b/internal/drivers/brokerdriver/producer.go index a3df373ec86e691c6a675389921a037fa7ae6ac7..e037aac06b3c6e2911851f722dd17017b5c21653 100644 --- a/internal/drivers/brokerdriver/producer.go +++ b/internal/drivers/brokerdriver/producer.go @@ -1,6 +1,9 @@ package brokerdriver import ( + "fmt" + "query-service/pkg/logger" + "github.com/streadway/amqp" "github.com/thijsheijden/alice" ) @@ -13,5 +16,8 @@ type AliceProducer struct { // PublishMessage will publish a message to the specified queue id func (ap *AliceProducer) PublishMessage(body *[]byte, queueID *string, headers *amqp.Table) { + sessionID := (*headers)["sessionID"] + logger.Log(fmt.Sprintf("Publishing message to queue %v, for session %v", *queueID, sessionID)) + ap.producer.PublishMessage(*body, queueID, headers) } diff --git a/internal/usecases/produce/produce.go b/internal/usecases/produce/produce.go index cd1e0c9b6351f555ef8d86b80c71b64db873a38d..be56ec75e85338c490be0603b96fcf9bcb1e2137 100644 --- a/internal/usecases/produce/produce.go +++ b/internal/usecases/produce/produce.go @@ -38,7 +38,7 @@ func (s *Service) PublishMessage(data *[]byte, sessionID *string) { clientUpdaterID := s.keyValueStore.Get(sessionID) headers := amqp.Table{} - headers["sessionID"] = sessionID + headers["sessionID"] = *sessionID headers["type"] = "queryResult" s.producerDriver.PublishMessage(data, clientUpdaterID, &headers) } diff --git a/internal/usecases/request/request.go b/internal/usecases/request/request.go index 51b451600aa95af457884e1678edab0a097cc21b..4b8e4d70e9f226ae6a341b5af4354ea5c73cd693 100644 --- a/internal/usecases/request/request.go +++ b/internal/usecases/request/request.go @@ -92,7 +92,7 @@ func (s *Service) SendAQLQuery(AQLQuery string) (*[]Document, error) { //formatToJSON(doc) } - writeJSON(queryResult) + // writeJSON(queryResult) //file, err := json.MarshalIndent(queryResult, "", " ") return &queryResult, nil } diff --git a/result.json b/result.json deleted file mode 100644 index b3d8db87d40f6145077b86578c6281f62e5eaeae..0000000000000000000000000000000000000000 --- a/result.json +++ /dev/null @@ -1,86 +0,0 @@ -[ - { - "_id": "airports/6N5", - "_key": "6N5", - "_rev": "_cIYKbr6-Aw", - "attributes": { - "city": "New York", - "country": "USA", - "lat": 40.74260167, - "long": -73.97208306, - "name": "E 34th St Heliport", - "state": "NY", - "vip": false - } - }, - { - "_id": "airports/6N7", - "_key": "6N7", - "_rev": "_cIYKbr6-Ay", - "attributes": { - "city": "New York", - "country": "USA", - "lat": 40.73399083, - "long": -73.97291639, - "name": "New York Skyports Inc. SPB", - "state": "NY", - "vip": false - } - }, - { - "_id": "airports/JFK", - "_key": "JFK", - "_rev": "_cIYKbs2-_F", - "attributes": { - "city": "New York", - "country": "USA", - "lat": 40.63975111, - "long": -73.77892556, - "name": "John F Kennedy Intl", - "state": "NY", - "vip": true - } - }, - { - "_id": "airports/JRA", - "_key": "JRA", - "_rev": "_cIYKbs2-_h", - "attributes": { - "city": "New York", - "country": "USA", - "lat": 40.75454583, - "long": -74.00708389, - "name": "Port Authority-W 30th St Midtown Heliport", - "state": "NY", - "vip": false - } - }, - { - "_id": "airports/JRB", - "_key": "JRB", - "_rev": "_cIYKbs2-_j", - "attributes": { - "city": "New York", - "country": "USA", - "lat": 40.70121361, - "long": -74.00902833, - "name": "Downtown Manhattan/Wall St. Heliport", - "state": "NY", - "vip": false - } - }, - { - "_id": "airports/LGA", - "_key": "LGA", - "_rev": "_cIYKbt---s", - "attributes": { - "city": "New York", - "country": "USA", - "lat": 40.77724306, - "long": -73.87260917, - "name": "LaGuardia", - "state": "NY", - "vip": false - } - } -] \ No newline at end of file