LCA as Google functions: Development
Learn how to set up an LCA as a Google Cloud run function.
Ensure that the
iam.disableCrossProjectServiceAccountUsage
Boolean constraint is not enforced for the project.Steps to set up Google LCA:
- Use the
life-cycle-framework-google-function
repository to write the custom LCA logic.Note: For code that demonstrates how to implement LCA logic using Google Cloud Run functions, see sample-lca-googlefunction. - To get the Life Cycle Framework for the Google function library, add the following Maven dependency:
<dependency> <groupId>com.reltio</groupId> <artifactId>life-cycle-framework-google-function</artifactId> </dependency>
- Download the dependency from the Reltio public repository.Note: For more information about accessing the LCA framework from the Reltio public repository, see topic LCA Framework.Add the following code to the repository and the settings.xml file in the Maven folder or the pom file:
<repository> <id>reltio-libs-public</id> <name>Reltio public repository</name> <url>http://repo.dev.reltio.com/content/repositories/public</url> </repository>
- Extend the
com.reltio.lifecycle.googlefunction.LifeCycleGoogleFunction
class.This class extendscom.reltio.lifecycle.framework.LifeCycleActionBase
and adds functionality specific to the execution of the Google function.You must package a Life Cycle Action Handler for deployment as a Google function with all the dependencies. The handler is invoked as a standalone application and not inside the Life Cycle Action Service infrastructure.
- To create both a JAR with dependencies and a ZIP file in a Maven project, add the following plugin to the
pom
file:<plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <!-- First execution for jar --> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </execution> <!-- Second execution for zip --> <execution> <id>make-zip</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <descriptors> <descriptor>src/assembly/zip.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin>
- Add the following assembly descriptor to src/assembly/zip.xml:
<assembly> <id>zip-with-dependencies</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <files> <file> <source>${project.build.directory}/${project.artifactId}-${project.version}-jar-with-dependencies.jar</source> <outputDirectory>/</outputDirectory> </file> </files> </assembly>
This configuration generates both a JAR file with all dependencies and a ZIP file containing the JAR.