Re: Camel Salesforce Component can't find Platform Event object

2020-05-21 Thread Anne Nguyen
Thanks to @Otavio Rodolfo Piske suggestion of setting the api version
higher than 34 (in my case I set it to 48) and it works fine now.


Re: Unable to subscribe to Salesforce Platform Event with camel-salesforce-3.4.0-SNAPSHOT

2020-05-21 Thread Anne Nguyen
Thanks Otavio! After setting the API to 48 I can now receive the Event.

On Thu, May 21, 2020 at 8:29 PM Otavio Rodolfo Piske
 wrote:
>
> Hello,
>
> I think it might be related to the Salesforce API version. Camel uses 34.0
> by default and I think you need, at least, 37.0. I noticed a similar
> condition when working on the Salesforce test cases for the Camel Kafka
> Connector.
>
> I am quoting below the comment I added to the test case as to why this
> seemed to happen on that occasion:
>
> /*
> * NOTE: this test requires SalesForce API >= than 37.0. Camel defaults to
> * API version 34.0.
> *
> * The reason is that on older versions of this API did not return the list
> * of supported extensions during the hand-shake (ie.:
> * ext={replay=true, payload.format=true}). This behavior causes the rcvMeta
> * handler on the CometDReplayExtension class in the salesforce component to
> * consider the replay extension as "not supported".
> *
> * Subsequently, when using the /meta/subscribe channel to subscribe to
> * account change events on /data/AccountChangeEvent, the replay ID is not
> * provided on the request message - and it is a required parameter. This
> * leads to a situation where the Salesforce API server returns a plain
> * HTTP error 500 without much details.
> */
>
> I hope this helps somehow.
>
> Kind regards
>
>
> On Thu, May 21, 2020 at 8:56 AM Anne Nguyen  wrote:
>
> > Hi All,
> >
> > I'm trying to subscribe to a Platform Event in Salesforce:
> >
> > from("salesforce:event/Moodle__e?replayId=-1")
> > .streamCaching()
> > .process( exchange ->{
> > PlatformEvent event =
> > exchange.getIn().getBody(PlatformEvent.class);
> > System.out.println("*Receive Event : " +
> > event.getEventData().toString());
> >});
> >
> > However receive the following error:
> >
> > 2020-05-21 14:23:35.061  WARN 3472 --- [ent@3cad68df-20]
> > o.a.c.c.salesforce.SalesforceConsumer: Error subscribing to
> > event/Moodle__e: {httpCode=500}. Caused by:
> > [org.apache.camel.component.salesforce.api.SalesforceException - Error
> > subscribing to event/Moodle__e: {httpCode=500}]
> >
> > org.apache.camel.component.salesforce.api.SalesforceException: Error
> > subscribing to event/Moodle__e: {httpCode=500}
> > at
> > org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper$7.onMessage(SubscriptionHelper.java:446)
> > [camel-salesforce-3.4.0-SNAPSHOT.jar:3.4.0-SNAPSHOT]
> > at
> > org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyOnMessage(AbstractClientSession.java:583)
> > [cometd-java-common-4.0.4.jar:4.0.4]
> > at
> > org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyMessageListeners(AbstractClientSession.java:568)
> > [cometd-java-common-4.0.4.jar:4.0.4]
> > at
> > org.cometd.common.AbstractClientSession.notifyListeners(AbstractClientSession.java:308)
> > [cometd-java-common-4.0.4.jar:4.0.4]
> > at
> > org.cometd.common.AbstractClientSession.lambda$receive$4(AbstractClientSession.java:269)
> > [cometd-java-common-4.0.4.jar:4.0.4]
> > at org.cometd.bayeux.Promise$2.succeed(Promise.java:103)
> > ~[bayeux-api-4.0.4.jar:4.0.4]
> > at
> > org.cometd.common.AsyncFoldLeft$AbstractLoop.run(AsyncFoldLeft.java:199)
> > ~[cometd-java-common-4.0.4.jar:4.0.4]
> > at org.cometd.common.AsyncFoldLeft.run(AsyncFoldLeft.java:93)
> > ~[cometd-java-common-4.0.4.jar:4.0.4]
> > at
> > org.cometd.common.AbstractClientSession.extendIncoming(AbstractClientSession.java:103)
> > [cometd-java-common-4.0.4.jar:4.0.4]
> > at
> > org.cometd.common.AbstractClientSession.receive(AbstractClientSession.java:263)
> > [cometd-java-common-4.0.4.jar:4.0.4]
> > at
> > org.cometd.client.BayeuxClient.failMessage(BayeuxClient.java:810)
> > ~[cometd-java-client-4.0.4.jar:4.0.4]
> > at
> > org.cometd.client.BayeuxClient.messageFailure(BayeuxClient.java:806)
> > ~[cometd-java-client-4.0.4.jar:4.0.4]
> > at
> > org.cometd.client.BayeuxClient.messagesFailure(BayeuxClient.java:659)
> > ~[cometd-java-client-4.0.4.jar:4.0.4]
> > at
> > org.cometd.client.BayeuxClient$MessageTransportListener.onFailure(BayeuxClient.java:1266)
> > ~[cometd-java-client-4.0.4.jar:4.0.4]
> > at
> > org.cometd.client.transport.LongPollingTransport$2.onComplete(LongPollingTransport.java:255)
> > ~[cometd-java-client-4.0.4.jar:4.0.4]
> > at
> > org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:218)
> > ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
> > at
> > org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:210)
> > ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
> > at
> > org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:543)
> > ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
> > at
> > org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpRec

Re: add/remove JAAS users and roles within a Camel route?

2020-05-21 Thread Gerald Kallas - mailbox.org
Yes, that’s quite clear. I wonder if there is an access to the OSGi CLI 
commands jaas:* from a Camel route directly. At the moment I‘m using camel-exec 
with the karaf client.

Sent by my mobile device
- Gerald Kallas

> Am 21.05.2020 um 19:42 schrieb Alex Soto :
> 
> One way to do this is to store the user and role directly in the underlying 
> storage for the JAAS security context.
> For example, in the case of the default “karaf” security context, users and 
> roles are stored in the ‘etc/users.properties’ file,  but you may choose to 
> store this in a database table, LDAP server,  etc.  
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On May 20, 2020, at 3:48 PM, Gerald Kallas  wrote:
>> 
>> Tx JB.
>> 
>> So in this case, how can i call the jaas:* service from a Camel route? I did 
>> some research but wasn't able to find this ..
>> 
>> Regards
>> - Gerald
>> 
>>> Jean-Baptiste Onofre  hat am 20. Mai 2020 20:25 
>>> geschrieben:
>>> 
>>> 
>>> Hi,
>>> 
>>> You mean on a JAAS backend ?
>>> 
>>> JAAS doesn’t provide anything about that. That’s why in Karaf we have the 
>>> "backend" service attached to some login modules.
>>> In your Camel route, you can interact with these services (as the jaas:* 
>>> commands do in Karaf).
>>> 
>>> Regards
>>> JB
>>> 
 Le 20 mai 2020 à 19:50, Gerald Kallas  a écrit :
 
 Hi all,
 
 is it possible to add/remove users and roles inside a Camel route 
 (Blueprint DSL) or at least w/ a piece of Java code inside a bean?
 
 Thanks in advance for any hints
 - Gerald
> 



Re: add/remove JAAS users and roles within a Camel route?

2020-05-21 Thread Alex Soto
One way to do this is to store the user and role directly in the underlying 
storage for the JAAS security context.
For example, in the case of the default “karaf” security context, users and 
roles are stored in the ‘etc/users.properties’ file,  but you may choose to 
store this in a database table, LDAP server,  etc.  
 
Best regards,
Alex soto




> On May 20, 2020, at 3:48 PM, Gerald Kallas  wrote:
> 
> Tx JB.
> 
> So in this case, how can i call the jaas:* service from a Camel route? I did 
> some research but wasn't able to find this ..
> 
> Regards
> - Gerald
> 
>> Jean-Baptiste Onofre  hat am 20. Mai 2020 20:25 
>> geschrieben:
>> 
>> 
>> Hi,
>> 
>> You mean on a JAAS backend ?
>> 
>> JAAS doesn’t provide anything about that. That’s why in Karaf we have the 
>> "backend" service attached to some login modules.
>> In your Camel route, you can interact with these services (as the jaas:* 
>> commands do in Karaf).
>> 
>> Regards
>> JB
>> 
>>> Le 20 mai 2020 à 19:50, Gerald Kallas  a écrit :
>>> 
>>> Hi all,
>>> 
>>> is it possible to add/remove users and roles inside a Camel route 
>>> (Blueprint DSL) or at least w/ a piece of Java code inside a bean?
>>> 
>>> Thanks in advance for any hints
>>> - Gerald



Re: Unable to subscribe to Salesforce Platform Event with camel-salesforce-3.4.0-SNAPSHOT

2020-05-21 Thread Otavio Rodolfo Piske
Hello,

I think it might be related to the Salesforce API version. Camel uses 34.0
by default and I think you need, at least, 37.0. I noticed a similar
condition when working on the Salesforce test cases for the Camel Kafka
Connector.

I am quoting below the comment I added to the test case as to why this
seemed to happen on that occasion:

/*
* NOTE: this test requires SalesForce API >= than 37.0. Camel defaults to
* API version 34.0.
*
* The reason is that on older versions of this API did not return the list
* of supported extensions during the hand-shake (ie.:
* ext={replay=true, payload.format=true}). This behavior causes the rcvMeta
* handler on the CometDReplayExtension class in the salesforce component to
* consider the replay extension as "not supported".
*
* Subsequently, when using the /meta/subscribe channel to subscribe to
* account change events on /data/AccountChangeEvent, the replay ID is not
* provided on the request message - and it is a required parameter. This
* leads to a situation where the Salesforce API server returns a plain
* HTTP error 500 without much details.
*/

I hope this helps somehow.

Kind regards


On Thu, May 21, 2020 at 8:56 AM Anne Nguyen  wrote:

> Hi All,
>
> I'm trying to subscribe to a Platform Event in Salesforce:
>
> from("salesforce:event/Moodle__e?replayId=-1")
> .streamCaching()
> .process( exchange ->{
> PlatformEvent event =
> exchange.getIn().getBody(PlatformEvent.class);
> System.out.println("*Receive Event : " +
> event.getEventData().toString());
>});
>
> However receive the following error:
>
> 2020-05-21 14:23:35.061  WARN 3472 --- [ent@3cad68df-20]
> o.a.c.c.salesforce.SalesforceConsumer: Error subscribing to
> event/Moodle__e: {httpCode=500}. Caused by:
> [org.apache.camel.component.salesforce.api.SalesforceException - Error
> subscribing to event/Moodle__e: {httpCode=500}]
>
> org.apache.camel.component.salesforce.api.SalesforceException: Error
> subscribing to event/Moodle__e: {httpCode=500}
> at
> org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper$7.onMessage(SubscriptionHelper.java:446)
> [camel-salesforce-3.4.0-SNAPSHOT.jar:3.4.0-SNAPSHOT]
> at
> org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyOnMessage(AbstractClientSession.java:583)
> [cometd-java-common-4.0.4.jar:4.0.4]
> at
> org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyMessageListeners(AbstractClientSession.java:568)
> [cometd-java-common-4.0.4.jar:4.0.4]
> at
> org.cometd.common.AbstractClientSession.notifyListeners(AbstractClientSession.java:308)
> [cometd-java-common-4.0.4.jar:4.0.4]
> at
> org.cometd.common.AbstractClientSession.lambda$receive$4(AbstractClientSession.java:269)
> [cometd-java-common-4.0.4.jar:4.0.4]
> at org.cometd.bayeux.Promise$2.succeed(Promise.java:103)
> ~[bayeux-api-4.0.4.jar:4.0.4]
> at
> org.cometd.common.AsyncFoldLeft$AbstractLoop.run(AsyncFoldLeft.java:199)
> ~[cometd-java-common-4.0.4.jar:4.0.4]
> at org.cometd.common.AsyncFoldLeft.run(AsyncFoldLeft.java:93)
> ~[cometd-java-common-4.0.4.jar:4.0.4]
> at
> org.cometd.common.AbstractClientSession.extendIncoming(AbstractClientSession.java:103)
> [cometd-java-common-4.0.4.jar:4.0.4]
> at
> org.cometd.common.AbstractClientSession.receive(AbstractClientSession.java:263)
> [cometd-java-common-4.0.4.jar:4.0.4]
> at
> org.cometd.client.BayeuxClient.failMessage(BayeuxClient.java:810)
> ~[cometd-java-client-4.0.4.jar:4.0.4]
> at
> org.cometd.client.BayeuxClient.messageFailure(BayeuxClient.java:806)
> ~[cometd-java-client-4.0.4.jar:4.0.4]
> at
> org.cometd.client.BayeuxClient.messagesFailure(BayeuxClient.java:659)
> ~[cometd-java-client-4.0.4.jar:4.0.4]
> at
> org.cometd.client.BayeuxClient$MessageTransportListener.onFailure(BayeuxClient.java:1266)
> ~[cometd-java-client-4.0.4.jar:4.0.4]
> at
> org.cometd.client.transport.LongPollingTransport$2.onComplete(LongPollingTransport.java:255)
> ~[cometd-java-client-4.0.4.jar:4.0.4]
> at
> org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:218)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
> at
> org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:210)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
> at
> org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:543)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
> at
> org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:523)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
> at
> org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:486)
> ~[jetty-client-9.4.27.v20200227.jar:9.4.27.v20200227]
> at
> org.eclipse.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:326)
> ~[jetty-client-