Changeset 612
- Timestamp:
- 04/23/07 16:29:20 (2 years ago)
- Files:
-
- trunk/src/hefeweizen_big_ania.rb (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/hefeweizen_big_ania.rb
r604 r612 371 371 def listen_to_ania 372 372 command = nil 373 # endless loop of big ania. Will always listen to the queue 373 374 while true do 374 375 begin 375 376 while (command = $pipe_to_me.readline) do 376 # puts "XXbeginXXXXX:#{command.strip}" 377 # @logger.debug "Command received: #{command.strip}" if @debug 377 # @logger.debug "Command received: #{command.strip}" if @debug 378 378 processed = process_command_from_ania command 379 # puts "XXendXXXXXXX:#{command.strip}"380 # @logger.debug "Command processed: #{command.strip}" if @debug381 379 if @exit == true then 382 380 return 0 … … 384 382 end 385 383 rescue EOFError => error 386 puts "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 387 puts "BIG ANIA PIPE ERROR: #{error.to_s}XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 388 puts "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 384 @logger.error "#{me} Big Ania Reading Pipe Error: #{error.inspect}" if @error 389 385 sleep 0.1 390 386 end … … 403 399 command_hash = HefeWeizen::HefeWeizenLibrary::HefeWeizenCommand.command_to_hash command 404 400 if command_hash.nil? then 405 @logger.error "#{me}: Unable to convert the command to a hash. This indicates the the command was incomplete or unknown. Command was: #{command}" 401 @logger.error "#{me}: Unable to convert the command to a hash. This indicates the the command " + 402 "was incomplete or unknown. Command was: #{command}" if @error 406 403 processed = false 407 404 else 408 405 command = command_hash['command'] 409 410 406 if !command.nil? and !command.empty? then 411 407 if !command_hash['transaction_id'].nil? then … … 420 416 end 421 417 end 422 # regular testing423 418 b2b_system = @b2b_systems[command_hash['b2b_system_name']] 424 419 if b2b_system.nil? then 425 @logger.error "#{me}: Error getting the b2b system from the command: #{command}." 420 @logger.error "#{me}: Error getting the b2b system from the command: #{command}." if @error 426 421 processed = false 427 422 else … … 431 426 new_command = nil 432 427 begin 433 (processed, new_command = b2b_system.process_command( transaction, command, command_hash )) if !processed428 (processed, new_command = b2b_system.process_command( transaction, command, command_hash )) unless processed 434 429 if processed == true then 435 @logger. debug"#{me}: Successfully processed command '#{command}'." if @debug430 @logger.info "#{me}: Successfully processed command '#{command}'." if @debug 436 431 if new_command then 437 432 @logger.debug "#{me}: Sending new command to ania. command: '#{new_command}'." if @debug 438 433 say_to_ania new_command 439 434 end 435 else 436 @logger.warn "#{me}: Unsuccessfully processed command '#{command}'." if @warn 437 # questions: 438 # o close transaction? 439 # o fail transaction? 440 440 end 441 441 rescue Exception => e 442 @logger.error "#{me}: Unexpected and unhandled error happened. The system may have become unstable. Error: #{e.to_s}." 443 @logger.error "#{me}: Error time: #{Time.now}." 444 @logger.error "#{me}: Error traceback: #{e.backtrace}." 442 @logger.error "#{me}: Unexpected and unhandled error happened. The system may have become unstable. Error: #{e.to_s}." if @error 443 @logger.error "#{me}: Error time: #{Time.now}." if @error 444 @logger.error "#{me}: Error traceback: #{e.backtrace}." if @error 445 445 end 446 446 end 447 447 else 448 @logger.error "#{me}: Error getting a transaction for command: #{command}." 448 @logger.error "#{me}: Error getting a transaction for command: #{command}." if @error 449 449 processed = false 450 450 end 451 451 else 452 @logger.error "#{me}: Error missing transaction id in the command. Every command must have a transaction id." 452 @logger.error "#{me}: Error missing transaction id in the command. Every command must have a transaction id." if @error 453 453 processed = false 454 454 end
