Monday 30 March 2015

Business Events: JDBC Connection fails from BE Studio/Runtime

Is the JDBC connection fails while trying to test the from Business events Studio? Even many times while running the BE code in local machine, errors are generated, reflecting failure of the JDBC connection. This is a very common issue. It is observed during the first run, just after the installation of Business Events.

This is due to the fact, Business Events do not comes with preconfigured TRAs for JDBC connection. So, it needs to be configured explicitly.

Follow the below steps to configure JDBC connection.

1. If you are getting this error at design time (while checking the connection from eclipse)
   -- edit studio.tra {location <BE_HOME>\studio\eclipse\configuration}
           edit the property (add the following at the end of the line)
               studio.extended.classpath= C:/tibco/be/5.1/studio/eclipse/thirdparty    {Assuming the JDBC jars are at loacation C:/tibco/be/5.1/studio/eclipse/thirdparty} 

2. If you are getting this error at run time
--edit be-engine.tra
       add property
           tibco.env.JDBC_HOME=C:/tibco/be/5.1/studio/eclipse/thirdparty {Assuming the JDBC jars are at loacation C:/tibco/be/5.1/studio/eclipse/thirdparty}

        and edit property
            tibco.class.path.extended %CUSTOM_EXT_PREPEND_CP%%PSP%%STD_EXT_CP%%PSP%%CUSTOM_EXT_APPEND_CP%%PSP%%JDBC_HOME%


3. If you are the still getting this error, check your Oracle listener is running. Try to connect it from any other application like SQLDeveloper or TIBCO BW etc.

BusinessEvents: Rulefunction is not available for preprocessor in CDD

It happen many times, that you have created a rulefunction and that is not available in preprocessor selection list in CDD.

Well preprocessors are a specific type of rulefunction, if the criteria are not matched properly while defining the rulefunction, then the rulefunction would not be available as a preprocessor.

The crucial factor is the scope. It should contain only one entity in the scope, no less no more. Also, that entity must me an event (concepts are not allowed.)

Synchronous Communication from Business Events.

==============================================

Is it possible to get a response Synchronously from a Business Events rule?

Yes, it is possible to get Synchronous reply from BusinessEvents. There are few situation where it is very much require to do so.
1.  Calling a SOAP service from TIBCO BusinessEvents.
2.  Getting some responses in Inference Engine from Query Engine. 

In order to achieve these requirements use HTTP channel and invoke the function HTTP.sendRequest().

Here is the synopsis.
===============
1. Create a "Request event" with default HTTP destination.
2. Create a "Response event".
3. In the rule. 
    a. create the instance of the request event.
    b. invoke HTTP.sendRequest(URL of the service, request event Instance, URI of the response 
                                                    Event, TimeOut)
        e.g    Event.responseEvent  respone =  HTTP.sendRequest( 
                                                               "http://localhost:6666/Channels/HTTP/GetCustomerDetails", 
                                                                requestEvent, 
                                                                "/Events/responseEvent",-1);

Code

4.  From Query Engine or from other Inference engine reply the call using Event.replyEvent().

But we need to consider the performance factor while doing so. It is not always a good practice to doing so. But at occasions if there is no other way apart from synchronous call from RTC this POC can be use for that.

**Please feel free to post your queries and comments. Also, If the POC is required for the same, let me know as comment.