title: Nashorn access Java object's methods
body: <p>I have the following code, it is class which defines bean, where RabbitTemplate injects when bean is created:</p>
  
  <pre><code>public class A {
      private RabbitTemplate rabbitTemplate;
  
      public A(RabbitTemplate rabbitTemplate) {
           this.rabbitTemplate = rabbitTemplate;
      }
  
      public void sendMessage(Message message) {
           ...
           rabbitTemplate.send(message);
           ...
      }
  
      public void receiveMessage(Message message) {
          ...
          invocable.invokeFunction("main", message.toJSObject());
          ...
      }
  }
  </code></pre>
  
  <p><code>receiveFunction</code> runs when we get some message in queue, it calls function <code>main</code> which is defined in javascipt code and loaded to ScriptEngine.
  I want to be able to invoke function <code>sendMessage</code> from javascript code.
  How can I do this?</p>