Synchronization is handled by processors which are responsible for creating the messages sent to a destination instance, and processing received incoming messages.

Exalate uses a set of synchronization processor to handle outgoing and incoming messages. We call them Sync Rules. You can find Sync Rules as a separate tab when you select the connection to edit.


What's a processor

A processor is a groovy based script which can be used to implement filtering, mapping, and transformation. These are essential operations in any synchronization.

Groovy is a dynamic language for the Java platform. Check out the following links to get more details about Groovy and how to develop in this language:

 

Processor types

There are 3 different processor types in the Sync Rules. Every processor has its own purpose. 

For more details check the synchronization process article.

Outgoing sync: Data filter

The data filter processor prepares a replica which is sent to the remote instance.

InputissueThe issue you need to synchronize.
OutputreplicaThe replica which will be sent to the remote instance.

 

A simple Data filter example

#
# Send the summary, description, comments and attachments to the remote instance by setting certain fields of the replica object
#
 
replica.summary     = issue.summary
replica.description = issue.description
replica.comments    = issue.comments
replica.attachments = issue.attachments

When the resulting replica is empty, then nothing is synchronized. Check the Unidirectional synchronization for more details.

You can set conditions in Data Filter as below: 

Condition example: Don't send anything when priority is trivial

#
# Send the summary, description, comments and attachments to the remote instance by setting the different fields of the replica object - unless it's a trivial issue.
#
 
if (issue.priority.name = "Trivial") {
	return
}
replica.summary     = issue.summary
replica.description = issue.description 
replica.comments    = issue.comments
replica.attachments = issue.attachments
 


Incoming sync for new issues: Create processor

The create processor is executed only with the first synchronization request of an issue from the remote instance. Using the create processor, you must define the target project, issuetype, and summary.

Here you can define what fields you would like to receive from the remote side. You can also set your own values for any local issue field.

InputreplicaThe information sent from the originating instance.
OutputissueAn issue object which will be used to create the local issue.

 

A simple Create processor example

#
#  Set up the issue object so that an appropriate replica can be created
#
 
issue.projectKey = "ACME"
issue.typeName   = "Task"
issue.summary    = replica.summary

If you don't specify the issue reporter in the create processor, the proxy user will be set as default reporter.

You can use script helpers in order to configure advanced conditions for your synchronization.

More advanced example

#
# 	Create a request in the support project, but if it's a critical issue in the customer's WEB project, assign it to Kevin Spacey, as he needs to ensure
#   smooth commmunication.
#
 
 
issue.project = nodeHelper.getProject("ACME")

if (replica.priority.name = "Critical" && replica.project.key = "WEB") {
 	issue.assignee = nodeHelper.getUser("kspacey") // assign to Kevin
	issue.priority = nodeHelper.getPriority("Blocker")
} else {
	issue.priority = nodeHelper.getPriority("Major")
}
 
issue.summary = replica.summary
issue.projectKey = "SUPPORT"
issue.typeName = "Request"

#
#  Set up the issue object such that an appropriate local issue can be created 
#
 
issue.summary = replica.summary
issue.projectKey = "ACME"
issue.typeName = "Task"
 


Incoming sync for existing issues: Change processor

The change processor is executed when an incoming synchronization request is received for an already synced issue.
 

InputreplicaThe current information sent from the originating instance.
 previousThe previous information sent from the originating instance.
OutputissueAn issue object which will be used to update the local node issue.

 

A simple example of the synced issues update

#
# Update the local issue with the data received from the remote side:
# If the remote issue's summary, description, comment or attachment is updated, local issue will be updated as well.
#
 
issue.summary      = replica.summary
issue.description  = replica.description
issue.comments     = commentHelper.mergeComments(issue,replica)
issue.attachments  = commentHelper.mergeAttachments(issue,replica)

Default configuration

By default, Exalate configures some basic scripts in the Sync Rules for your convenience.

Below is the default configuration of the Data Filter, Create Processor and Change Processor. It helps to synchronize an issue fields such as: assignee, reporter, summary, description, comments, resolution, status, attachments and project.

Outgoing sync: Data filter

Send default data to the remote instance.

Default Data filter scripts

replica.key            = issue.key
replica.type           = issue.type 
replica.assignee       = issue.assignee 
replica.reporter       = issue.reporter
replica.summary        = issue.summary
replica.description    = issue.description
replica.labels         = issue.labels
replica.comments       = issue.comments
replica.resolution     = issue.resolution
replica.status         = issue.status
replica.parentId       = issue.parentId
replica.priority       = issue.priority
replica.attachments    = issue.attachments
replica.project        = issue.project


Incoming sync for new issues: Create processor

When the first synchronization request of an issue from the remote instance is received, create the issue in project TEST, issue type Task. Copy received summary, description, comments, and attachments.

Default Create Processor

//Set project key from source issue, if not found set a default
issue.projectKey   = nodeHelper.getProject(replica.project?.key)?.key ?: "TEST"
//Set type name from source issue, if not found set a default
issue.typeName     = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task"
issue.summary      = replica.summary
issue.description  = replica.description
issue.comments     = commentHelper.mergeComments(issue, replica)
issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)

Incoming sync for existing issues: Change processor

Update local issue summary, description, add new comments and attachments and delete removed ones.

Default Change processor

issue.summary      = replica.summary
issue.description  = replica.description
issue.labels       = replica.labels
issue.comments     = commentHelper.mergeComments(issue, replica)
issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)