Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# Adding Custom Java Functions

Using TIBCO BusinessEvents, you can define custom functions and expose them as catalog functions. By exporting the project containing the custom Java catalog functions to a project library, the custom Java functions can be used in other projects.

Procedure
1. Define a simple Java class under the JavaSrc folder. For example, MyFunction.java.

2. To expose Java methods as functions, declare them as public static variables:

   Copy

       public static int sum(int a, int b)
       {
           int x = a+b;
           return x;
       }

3. The annotation @BE Package is a class level annotation: add the class-level annotation @BEPackage before any classes are declared.

       @BEPackage(catalog = "arithmeticOperations", category = "arithmetic.operations", synopsis = "Performs few arithemtic operations")

4. The annotation @BEFunction defines the synopsis, signature, parameters, return types, descriptions, examples and other relevant information about the function. The information provided in the annotation is displayed in the tooltip for the catalog function.

   Copy

       @BEFunction(name = "SummationTest",
                   description="Adds two given numbers",
                   signature="int sum(int a, int b)",
                          freturn = @com.tibco.be.model.functions.FunctionParamDescriptor(name = "", type = "int", desc = "Returns the summation of a and b."),
                   params = {
                   @com.tibco.be.model.functions.FunctionParamDescriptor(name = "a", type = "int", desc = "First arg"),
                   @com.tibco.be.model.functions.FunctionParamDescriptor(name = "b", type = "int", desc = "Arg two")
                   },
                   fndomain = {ACTION, CONDITION, QUERY, BUI}, version="1.0",see="",cautions="none", example=" ")

5. Save the file.

ResultOnce you add and save the annotations, the custom Java functions are available in the Catalog Functions view.

Did you find this helpful?

YesNo
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO BusinessEvents® Enterprise Edition

Copyright © 2004-2024. Cloud Software Group, Inc. All Rights Reserved.