You define configuration fields that show up in the Felix configuration screen by using a @Property annotations. For example:
@Property(description="adress to whom email is sent",value=DEFAULT_ADDRESS)
private static final String ADDRESS = "mailservice.address";
private String address;
You can configure your AEM service to use different configuration values. For example, you can configure 1 to many different instances of the same service.
Assume you want to develop a custom email service that contain the following configuration values.
the email address to which an email is sent
the email address from which the email is sent
You can configure the custom email service so that each service instance has a different value for these configuration settings. You can enter an AEM configuration value into an AEM configuration dialog, as shown here.
In this configuration dialog, the to and from email addresses are configurable. You can configure additional configuration settings for the same service.
When you use the custom Service within AEM, you can create a reference to the exact configuration service that you want to reference. To do this, you use the @Reference annotation and additional metadata such as:
@Reference(target = "(mailservice.label=InternetA)")
MailService mailServiceA;
@Reference(target = "(mailservice.label=InternetB)")
MailService mailServiceB;
In the above dialog, there is a additional field named emailservice.label. You can reference the value in this field with the target value when using the @Reference annotation.
This development article guides you through how to create an OSGi service where there are multiple configured services and how to use the @Reference(target = "(mailservice.label=InternetA)") annotation properly.
To read this development article, click https://helpx.adobe.com/experience-manager/using/osgi_multiservices.html.
MailService mailServiceB;
In the above dialog, there is a additional field named emailservice.label. You can reference the value in this field with the target value when using the @Reference annotation.
This development article guides you through how to create an OSGi service where there are multiple configured services and how to use the @Reference(target = "(mailservice.label=InternetA)") annotation properly.
To read this development article, click https://helpx.adobe.com/experience-manager/using/osgi_multiservices.html.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.