Created
February 14, 2013 13:53
-
-
Save proffalken/4952972 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@msg = @connection.receive | |
message_body = JSON.parse(@msg.body)[0]['body'] | |
#Resque.enqueue(NrodLookup,message_body) | |
current_sql_statement = "SELECT nlcdesc FROM tiplocdata WHERE stanox = '#{message_body['reporting_stanox']}'" | |
next_sql_statement = "SELECT nlcdesc FROM tiplocdata WHERE stanox = '#{message_body['next_report_stanox']}'" | |
# puts sql_statement | |
@client.query(current_sql_statement).each do | row | | |
@current_loc = row['nlcdesc'] | |
end | |
@client.query(next_sql_statement).each do | row | | |
@next_loc = row['nlcdesc'] | |
end | |
time_departed = Time.at(message_body['actual_timestamp'].to_i / 1000) | |
puts "#{message_body['train_id']} departed #{@current_loc} at #{time_departed} heading to #{@next_loc}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment