Guest User

Untitled

a guest
Jul 4th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. require 'tiny_tds'
  2. require 'active_support/core_ext/hash/conversions'
  3.  
  4. client = TinyTds::Client.new( username: 'sa',
  5. password: 'secret',
  6. host: '127.0.0.1',
  7. port: 1433,
  8. timeout: 0,
  9. database: 'ServiceBrokerMonolog')
  10. loop do
  11. results = client.execute("WAITFOR (RECEIVE * FROM Notifications);")
  12.  
  13. results.each do |row|
  14. client.execute("END CONVERSATION '#{row['conversation_handle']}';")
  15.  
  16. values = Hash.from_xml(row['message_body'])["root"]
  17. #<root><first type="string">lorem</first><second type="integer">0</second></root>
  18. puts values
  19. end
  20. end
Add Comment
Please, Sign In to add comment