// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
[id="extensions-salesforce"]
= Salesforce
:page-aliases: extensions/salesforce.adoc
:linkattrs:
:cq-artifact-id: camel-quarkus-salesforce
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Communicate with Salesforce using Java DTOs.
:cq-deprecated: false
:cq-jvm-since: 0.2.0
:cq-native-since: 0.0.2

ifeval::[{doc-show-badges} == true]
[.badges]
[.badge-key]##JVM since##[.badge-supported]##0.2.0## [.badge-key]##Native since##[.badge-supported]##0.0.2##
endif::[]

Communicate with Salesforce using Java DTOs.

[id="extensions-salesforce-whats-inside"]
== What's inside

* xref:{cq-camel-components}::salesforce-component.adoc[Salesforce component], URI syntax: `salesforce:operationName:topicName`

Please refer to the above link for usage and configuration details.

[id="extensions-salesforce-maven-coordinates"]
== Maven coordinates

https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-salesforce[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]

Or add the coordinates to your existing project:

[source,xml]
----
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-salesforce</artifactId>
</dependency>
----
ifeval::[{doc-show-user-guide-link} == true]
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
endif::[]

[id="extensions-salesforce-usage"]
== Usage
[id="extensions-salesforce-usage-generating-salesforce-dtos-with-the-salesforce-maven-plugin"]
=== Generating Salesforce DTOs with the `salesforce-maven-plugin`

ifeval::[{doc-show-extra-content} == true]
include::maven-plugin-unsupported.adoc[]
endif::[]

To generate Salesforce DTOs for your project, use the `salesforce-maven-plugin`. The example code snippet below creates a single DTO for the `Account` object.

[source,xml,subs="attributes+"]
----
<plugin>
    <groupId>org.apache.camel.maven</groupId>
    <artifactId>camel-salesforce-maven-plugin</artifactId>
    <version>{camel-version}</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <clientId>${env.SALESFORCE_CLIENTID}</clientId>
                <clientSecret>${env.SALESFORCE_CLIENTSECRET}</clientSecret>
                <userName>${env.SALESFORCE_USERNAME}</userName>
                <password>${env.SALESFORCE_PASSWORD}</password>
                <loginUrl>https://login.salesforce.com</loginUrl>
                <packageName>org.apache.camel.quarkus.component.salesforce.generated</packageName>
                <outputDirectory>src/main/java</outputDirectory>
                <includes>
                    <include>Account</include>
                </includes>
            </configuration>
        </execution>
    </executions>
</plugin>
----

[id="extensions-salesforce-usage-native-mode-support-for-pub-sub-api-with-pojo-pubsubdeserializetype"]
=== Native mode support for Pub / Sub API with POJO `pubSubDeserializeType`

When using the Camel Salesforce Pub / Sub API and `pubSubDeserializeType` is configured as `POJO`, you must register any classes configured on the `pubSubPojoClass` option for reflection.

For example, given the following route.

[source,java]
----
from("salesforce:pubSubSubscribe:/event/TestEvent__e?pubSubDeserializeType=POJO&pubSubPojoClass=org.foo.TestEvent")
    .log("Received Salesforce POJO topic message: ${body}");
----

Class `org.foo.TestEvent` would need to be registered for reflection.

[source,java]
----
package org.foo;

import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection
public class TestEvent {
    // Getters / setters etc
}
----

Refer to the xref:user-guide/native-mode.adoc#reflection[Native mode] user guide for more information.


[id="extensions-salesforce-ssl-in-native-mode"]
== SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add
`quarkus.ssl.native=true` to your `application.properties` yourself. See also
https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
