Skip to content
Snippets Groups Projects
Commit 76e76e8a authored by sivan's avatar sivan
Browse files

fix sessionid setting and more logging

parent f69a1e25
No related branches found
No related tags found
No related merge requests found
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)
}
......@@ -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)
}
......@@ -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
}
......
[
{
"_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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment