on 03-29-2018 1:48 AM - last edited on 02-04-2024 3:19 AM by postmig_api_4
Hello everyone,
Anyone already has used the ConnectivityConfiguration API ?
I need execute scheduled jobs and accordingly with sap.help I should use the authentication method with SAML2BearerAssertion using a technical user
I supplied the --technical-user-id in command neo hcmcloud-create-connection and the destination was created in subscription level
The application is supplied via subscription
In Java application, reading the documentation I tried this code, even with the destination created in sub account the result always is null ...
Context ctx = new InitialContext();
localConnectivityConfiguration = (ConnectivityConfiguration) ctx.lookup("java:comp/env/connectivityConfiguration");
localConnectivityConfiguration.getConfiguration("name of destination");
I also tried the method getConfiguration(String accountID, String DestinationName) with no success
Context ctx = new InitialContext();
localConnectivityConfiguration = (ConnectivityConfiguration) ctx.lookup("java:comp/env/connectivityConfiguration");
localConnectivityConfiguration.getConfiguration("AccountID", "name of destination");
How can i run the scheduled jobs in host and access destinations from consumer subaccount ?
accordingly with documentation ...
If you have two destinations with the same name, one configured on subaccount level and the other on application level, the getConfiguration() method will return the destination on subaccount level. The preference order is: subscription level -> subaccount level -> application level.
But this is not happening ...
Anyone already implemented scheduler with subscriptions or have faced something similar?
Hi Murilo,
Have you seen this blog?
When you schedule a task in Java, your application needs to execute the Destination API methods on a particular tenant (sub-account) in order to find the configuration. Check the Tenant API documentation.
So first you get the available subscriptions to your "global account" and later you call execute method with a callable object that will perform the calls to the destination API to retrieve the sub-account destinations and from there run any relevant Tasks.
Regards,
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the answer Ivan,
SAP Support suggested the same as you...
For someone else here are the snippet of code
try {
InitialContext ctx = new InitialContext();
Context hostContext = (Context) ctx.lookup("java:comp/env");
TenantContext tenantHostContext = (TenantContext) hostContext.lookup("TenantContext");
for(Tenant tenant: tenantHostContext.getSubscribedTenants()){
Map<String, String> lista = tenantHostContext.execute(tenant.getId(), classcallable);
lista.toString();
}
} catch (Exception e) {
e.printStackTrace();
}
public class ClassCallable implements Callable<Map<String, String>>{
public Map<String, String> call() throws Exception {
this.sync()
}
public Map<String, String> sync() throws NamingException {
Map<String, String> lista = this.sync();
return lista;
}
}
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.