paolo tarpanelli Posted August 7, 2019 Share Posted August 7, 2019 Hello, how can i return from a custom java function a class object from an external jar file. For example: let us suppose I have a Map operator containing my custom java function (fun) whic uses a class, from an external jar file, and returns an object x and I would liket that my fun return the object x such that the output of the Map operator is the object x. How can i do it: What type of return I need to specify in the .sbconf when I ama going to define the custom function Thank you best regards Paolo Link to comment Share on other sites More sharing options...
Steve Barber Posted August 9, 2019 Share Posted August 9, 2019 Hi Paolo, You can only return a Java data type that maps to a StreamBase data type and there is no defined mapping from java.lang.Object (POJO) directly to any StreamBase data type. Similarly theres no direct way for a POJO to traverse a StreamBase stream. You could have your custom function get the values of fields in your POJO and set corresponding fields in a com.streambase.sb.Tuple and have the function return that. To return a tuple type from a custom Java plugin function you will need to implement a custom function resolver for the plugin function. Another possibility is to serialize your POJO into a blob, but thats not very convenient in practice. Link to comment Share on other sites More sharing options...
paolo tarpanelli Posted August 9, 2019 Author Share Posted August 9, 2019 Clear. Thanks Link to comment Share on other sites More sharing options...
Steve Barber Posted August 9, 2019 Share Posted August 9, 2019 Here is a link to a Support Knowledge Base article that gives an example of how to define a custom Java plugin function that returns a StreamBase tuple data type, along with a corresponding custom function resolver: https://supportapps.tibco.com/ka/article/457/000028457.htm Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now