org.apache.servicemix.drools.model
Class JbiHelper

java.lang.Object
  extended by org.drools.event.DefaultAgendaEventListener
      extended by org.apache.servicemix.drools.model.JbiHelper
All Implemented Interfaces:
EventListener, org.drools.event.AgendaEventListener

public class JbiHelper
extends org.drools.event.DefaultAgendaEventListener

A helper class for use inside a rule to forward a message to an endpoint

Version:
$Revision: 426415 $

Constructor Summary
JbiHelper(DroolsEndpoint endpoint, MessageExchange exchange, org.drools.WorkingMemory memory)
           
 
Method Summary
 void activationCreated(org.drools.event.ActivationCreatedEvent event)
           
 void answer(Source content)
          Answer the exchange with the given response content
 void answer(String content)
           
 void fault(Source content)
          Send a JBI Error message (for InOnly) or JBI Fault message (for the other MEPs)
 void fault(String content)
           
 DeliveryChannel getChannel()
           
 ServiceMixClient getClient()
           
 ComponentContext getContext()
           
 DroolsEndpoint getEndpoint()
           
 Exchange getExchange()
           
 Log getLogger()
           
 int getRulesFired()
          Get the number of rules that were fired
 boolean isExchangeHandled()
          Has the MessageExchange been handled by the drools endpoint?
 void route(String uri)
          Forwards the inbound message to the given
 void routeTo(String content, String uri)
           
 void routeToDefault(String content)
           
 void sendTo(String content, String uri)
          Deprecated. 
 void update()
           
 
Methods inherited from class org.drools.event.DefaultAgendaEventListener
activationCancelled, afterActivationFired, beforeActivationFired
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JbiHelper

public JbiHelper(DroolsEndpoint endpoint,
                 MessageExchange exchange,
                 org.drools.WorkingMemory memory)
Method Detail

getEndpoint

public DroolsEndpoint getEndpoint()

getContext

public ComponentContext getContext()

getChannel

public DeliveryChannel getChannel()
                           throws MessagingException
Throws:
MessagingException

getClient

public ServiceMixClient getClient()

getExchange

public Exchange getExchange()

getLogger

public Log getLogger()

route

public void route(String uri)
           throws MessagingException
Forwards the inbound message to the given

Parameters:
uri -
localPart -
Throws:
MessagingException

routeTo

public void routeTo(String content,
                    String uri)
             throws MessagingException
Throws:
MessagingException

routeToDefault

public void routeToDefault(String content)
                    throws MessagingException
Throws:
MessagingException

sendTo

@Deprecated
public void sendTo(String content,
                              String uri)
            throws MessagingException
Deprecated. 

This method allows for an asynchronous send(). It has no error handling support or support for InOut/InOptionalOut MEPs.

Parameters:
content -
uri -
Throws:
MessagingException

fault

public void fault(String content)
           throws Exception
Throws:
Exception

fault

public void fault(Source content)
           throws Exception
Send a JBI Error message (for InOnly) or JBI Fault message (for the other MEPs)

Parameters:
content - the error content
Throws:
Exception

answer

public void answer(String content)
            throws Exception
Throws:
Exception

answer

public void answer(Source content)
            throws Exception
Answer the exchange with the given response content

Parameters:
content - the response
Throws:
Exception

update

public void update()

getRulesFired

public int getRulesFired()
Get the number of rules that were fired

Returns:
the number of rules

isExchangeHandled

public boolean isExchangeHandled()
Has the MessageExchange been handled by the drools endpoint?

Returns:

activationCreated

public void activationCreated(org.drools.event.ActivationCreatedEvent event)
Specified by:
activationCreated in interface org.drools.event.AgendaEventListener
Overrides:
activationCreated in class org.drools.event.DefaultAgendaEventListener


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.