Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with queues #11

Open
Kitton opened this issue Mar 10, 2014 · 2 comments
Open

Issues with queues #11

Kitton opened this issue Mar 10, 2014 · 2 comments

Comments

@Kitton
Copy link

Kitton commented Mar 10, 2014

Good day, I have some problems with the queues.

require 'torquespec'
require 'torquebox-core'
require 'torquebox-messaging'
require 'spec_helper'
require 'capybara'

app = <<-END.gsub(/^ {4}/,'')
    application:
      root:  #{File.dirname(__FILE__)}/../../../app
      env: test
    queues:
      /queues/async_mails_manual:
END

describe 'inside torquebox' do
  deploy(app)

  it "should send" do
    #Have tried with TorqueBox.fetch here before, didnt work either
    queue = TorqueBox::Messaging::Queue.new '/queues/async_mails_manual'
    p queue
    p queue.count_messages
    queue.publish("message_test")
    p queue.count_messages
  end
end

The output:

/home/gaf/.rvm/gems/jruby-1.7.9/gems/simplecov-0.7.1/lib/simplecov.rb:34 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
The signal KILL is in use by the JVM and will not work correctly on this platform
"/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java" -Xms512m -Xmx3000m -XX:MaxPermSize=512m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dorg.jboss.boot.log.file="/home/gaf/Work/etc/torquebox-3.0.2/jboss/standalone/log/boot.log" -Dlogging.configuration=file:"/home/gaf/Work/etc/torquebox-3.0.2/jboss/standalone/configuration/logging.properties" -jar "/home/gaf/Work/etc/torquebox-3.0.2/jboss/jboss-modules.jar" -mp "/home/gaf/Work/etc/torquebox-3.0.2/jboss/modules" -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir="/home/gaf/Work/etc/torquebox-3.0.2/jboss"
pid=17088
Waiting up to 120s for JBoss to boot

JBoss started in 9s
deploy /home/gaf/Work/d/api/.torquespec/inside_torquebox-knob.yml in 0s
#<TorqueBox::Messaging::Queue:0x63ee09a8 @name="/queues/async_mails_manual", @enumerable_options={}, @connect_options={}, @connection_factory=#<TorqueBox::Messaging::ConnectionFactory:0x20bc27d9 @tm=nil, @internal_connection_factory=nil>>
nil
nil

So instead of 0 I'm getting nil here and the message isn't published. Have used an advice from here http://stackoverflow.com/questions/17057616/torquebox-torquespec-testing-queues-cant-be-fetched-in-remote-describe-block , but still cant make it work. Any ideas?

@bbrowning
Copy link
Member

If you change your code to publish the message then receive a message, do you receive your published message? I'm wondering if it's just an issue with queue.count_messages not working properly outside the running TorqueBox.

The code in your "should send" block doesn't actually run inside TorqueBox. It's still running in your RSpec process, but should be able to connect to the running TorqueBox. If you want this code to actually run inside TorqueBox, you'd need to change your "describe" block to "remote_describe".

@Kitton
Copy link
Author

Kitton commented Mar 11, 2014

Confirm your assumption - "receive" method works, but in my code "count_messages" is used a lot :(
About remote_describe, it seems that Rails.root doesn't work there - I have got a lot of error in requires, like this one

    "failure-description" : {"JBAS014671: Failed services" : {"jboss.deployment.unit.\"inside_torquebox-knob.yml\".service.TorqueSpec::Daemon.create" : "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"inside_torquebox-knob.yml\".service.TorqueSpec::Daemon.create: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- lib/queues/abstract_queue\n    Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- lib/queues/abstract_queue"}},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants