Dynamic Binding Example
Application logic can depend on the value of the application and service name. In particular, the application logic may be used to dynamically determine the target of a reference invocation (also referred to as wire by implementation) in a mediation flow. The following example illustrates how to retrieve the application and service name in a Spring component that invokes a mediation component service, and set context parameters with that data:
String appName = componentContext.getApplicationName(); String svcname = componentContext.getRequestContext().getServiceName(); MutableRequestContext mutableRequestContext =componentContext.createMutableRequestContext(); mutableRequestContext.setParameter("ServiceName", java.lang.String.class,svcname); mutableRequestContext.setParameter("ApplicationName", java.lang.String.class, appName); componentContext.setRequestContext(mutableRequestContext);
The context parameters are then mapped in the mediation flow's Set Dynamic Reference task property sheet as follows: