Posted: Wed Mar 02, 2022 2:30 am Post subject: Basic question on JCNs
Centurion
Joined: 19 Apr 2010 Posts: 135
Hi
Can anyone please point me to a sample/discussion on how to use a JCN to implement classes that are not associated with the 4 templates that are supplied with the Java Compute Node Class Template wizard.
What I want to do is use a class that sets up an Athena client, submits a query to Athena, retrieves the result and then processes the result.
My (basic) understanding of setting up a JCN is that you need to select a template for the wizard, which then sets up something like this (I've used the Create new message template option):
Code:
public class Client_access_JavaCompute extends MbJavaComputeNode {
public void evaluate(MbMessageAssembly contact admin) throws MbException {
MbOutputTerminal out = getOutputTerminal("out");
MbOutputTerminal alt = getOutputTerminal("alternate");
.
.
.
I've tried replacing the Java code with the following:
Code:
public abstract class Client_access_JavaCompute extends MbJavaComputeNode {
public static void main(String[] args) throws InterruptedException
{
// Build an AmazonAthena client
AthenaClientFactory factory = new AthenaClientFactory();
AmazonAthena athenaClient = factory.createClient();
BIP4517E: An exception was issued when an instance of Java class xxx was being created for JCN yyy. The stack trace of the exception is:
'Frame: 0 java.lang.InstantiationException:
I need to find some guidance on where and how to replace this with the Java code that sets up the Athena client.
Alternatively, if an external Athena java client program alreadys exists you could call its methods directly from ESQL itself which saves the trouble of doing all the connection managment, exception handling etc...
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum