How can I connect Anaplan to Talend using Anaplan Jar Modules

nehanayal_0-1628157988296.png

How can I test if this jar library module is running fine.

Anaplan Home

Along with this jar file, I also have keystore(jks), pem files too.

 

Tagged:

Comments

  • Hi @nehanayal 

    I am curious how you want to use Talend to manage AnaplanConnect, as the BI Team in my organization uses Talend for our ETL processes and I manage job schedules through the portal.  However, I am not using Talend directly with AnaplanConnect.  Instead, I have a different scheduler tool that kicks off the AnaplanConnect batch scripts for imports and export in Anaplan, and then stages files for Talend to pick up and process back to our data warehouse.  Are you attempting to use Talend as a scheduler to run AnaplanConnect batch scripts?

    The way I set up our implementation, the AnaplanConnect installation is housed on a server with Java installed along with my keystore.  The scheduler calls the AnaplanConnect batch files that I wrote, which run on the server and use the key in my keystore to authenticate to Anaplan and run the actions specified in the batch files.

    I think you'll need to write your AnaplanConnect batch scripts and make sure they function properly when run from the server with your installation and keystore.  Then, you may be able to call the batch files via a Talend schedule.  But, you would call the batch files you write, not the .jar file you mention.  The .jar file is used by the "AnaplanClient.bat" (or "AnaplanClient.sh if you're using linux).  The "AnaplanClient.bat" file is used by the batch scripts you write to execute actions within your models.  

    Did you see the batch file examples in the installation directory related to using a java keystore?  I think they would help you a lot.  Once you get a batch file with the keystore certificate authentication process working properly, you should be able call the batch file using Talend scheduler.  

    Stacey_Gibbens_1-1628172263470.png

    Hope this helps!

    Stacey

     

  • To connect using keystore i need to write a batch file.

    Can we write this using Java code? If yes can you help me with the sample.

  • Hi @Stacey_Gibbens 

     

    Below is the Java Code Written which I found from Anaplan Community.

    Can you please let me know how I can a generate authentication using below code, also any operations I can perform to connect to anaplan

     

     

    ****************************

    System.out.println("The strings are created below");
    char[] password = "<keystore password>".toCharArray();
    String alias = "<your alias name heere>";
    String keystoreFilename = "<path to you keystore.jks>";
    String ServiceUrl="https://api.anaplan.com";
    String AuthUrl="https://auth.anaplan.com";
    SecureRandom random = new SecureRandom();
    random.setSeed(System.currentTimeMillis());
    byte bytes[] = new byte[150];
    random.nextBytes(bytes);
    String encodedData = Base64.getEncoder().encodeToString(bytes);
    try {
    KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
    System.out.println("KeyStore : " + ks);
    FileInputStream fis = new FileInputStream(keystoreFilename);
    ks.load(fis, password);
    PrivateKey key = (PrivateKey)ks.getKey(alias, password);
    System.out.println("Password: " + key);
    String signatureAlgorithm = "SHA512withRSA";

    Signature sig = Signature.getInstance(signatureAlgorithm);
    System.out.println("Signature: " + sig);
    sig.initSign(key);
    sig.update(bytes);
    byte[] signature_bytes = sig.sign();
    String encodedData_signed = Base64.getEncoder().encodeToString(signature_bytes);
    System.out.println("Encoded signed data: " + encodedData_signed);

    } catch (KeyStoreException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (GeneralSecurityException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } System.out.println("Encoded data: " + encodedData);

     

    **************************************

  • Hi @nehanayal 

    I'm sorry, I am not a Java developer -- I wrote our AnaplanConnect processes with Windows Batch files.  Here's an example that was provided to me when I first implemented our CA certificate.... something that I have just started looking at again, because our CA cert will be expiring soon.  This batch file should be run from the same directory where the AnaplanClient.bat file is located (see the line starting "set Command=.\AnaplanClient.bat" which calls the AnaplanConnect client, indicates the client is in the same directory as the batch file that calls it). 

    @echo off

    rem This example lists a user's workspaces

    set ServiceLocation="https://api.anaplan.com/"
    set Keystore="C:\Your Cert Name Here.jks"
    set KeystoreAlias="YourKeystoreAlias"
    set KeystorePassword="YourKeystorePassword"
    set WorkspaceId="Enter WS ID Here"
    set ModelId="Enter Model ID here"
    set Operation=-service "https://api.anaplan.com" -auth "https://auth.anaplan.com" -W

    rem *** End of settings - Do not edit below this line ***

    setlocal enableextensions enabledelayedexpansion || exit /b 1
    cd %~dp0
    set Command=.\AnaplanClient.bat -s %ServiceLocation% -k %Keystore% -ka %KeystoreAlias% -kp %KeystorePassword% -workspace %WorkspaceId% -model %ModelId% %Operation%
    @echo %Command%
    cmd /c %Command%
    pause

     

    Did you download the entire AnaplanConnect package?  Also, are you implementing an older version of AnaplanConnect on purpose?  There are newer versions that might be more useful.  It sounds like you might be missing some key guidance available online:
    https://help.anaplan.com/03144015-44e0-4f28-8cee-13e7ae9d9077-Anaplan-Connect

    https://community.anaplan.com/t5/How-To/Start-Here-Anaplan-Connect-2-0-and-JDBC-Connectivity/ta-p/110824 

    https://community.anaplan.com/t5/How-To/Anaplan-Connect-2-0-Approaches-to-Anaplan-integration-using-On/ta-p/110874

    Best of luck,

    Stacey

  • Hi @Stacey_Gibbens 

     

    Can you also send me sample of command which helps in triggering an action on Anaplan only

  • @nehanayal 

     

    The information in my previous post gives you that.  Truly, you should review all the information in the links I provided and download a full copy of the AnaplanConnect package.  It seems likely that you are trying to work with only a partial package and without reading all of the documentation.

     

    Good luck,

    Stacey

  • Hi @Stacey_Gibbens 

     

    Actually I wanted to know if its possible to create an action using command line/shell script

    Instead of creating an action in anaplan.

     

    Anyways Iam able to run these commands through Talend as well and now Iam able to perform import/export using these commands.

     

    Thank you so much for your support

     

     

  • Hi Everyone,

    I am struggling with connecting SQL Server table with Anaplan model. I am using Talend to do this integration and able to do successful authentication with Anaplan Model. Would you be able to guide on the further steps. Here is the link to my query: