Coherence Reference

Configuring Extend Proxy on the Coherence Server

To enable communication between GoldenGate Stream Analytics and the Coherence server, you must configure extend proxy on the Coherence server or the cluster. GGSA can connect to the Coherence server only by extending its proxy service. To configure extend proxy on the Coherence server, define the following configuration in the server’s cache-config.xml, as in the format below:
<caching-schemes>
      .............

      <proxy-scheme>
         <service-name>ExtendTcpProxyService</service-name>
         <acceptor-config>
            <tcp-acceptor>
               <local-address>
                  <address>{ADDRESS}</address>
                  <port>{PORT}</port>
               </local-address>
            </tcp-acceptor>
         </acceptor-config>
         <autostart>true</autostart>
      </proxy-scheme>

</caching-schemes>

Limitations of Coherence as Reference

The following are the limitations of a Coherence cache as a reference:
  • You cannot test the connection

  • You need to specify the cache name manually

  • You can choose only equal operator to establish a correlation with coherence reference

  • You must use manual shape

  • You can choose only one look-up condition under sources. This condition will be used for key look-up.

Loading Number Type Data on Coherence Cache

When you load big decimal number type data on the coherence cache, ensure that you include precision and scale. Only when you specify these values, the join functionality works.
Below is a sample in which a number type data is defined, with the scale and precision values specified:
NamedCache cache  = CacheFactory.getCache("externalcachetimestamp");

        java.math.BigDecimal big10 = new java.math.BigDecimal("10",new
MathContext(58)).setScale(56, RoundingMode.HALF_UP);

        Map<String,Object> order1 = new HashMap<String, Object>();
order1.put("strValue", "Test");
order1.put("intervalValue", "+000000002 03:04:11.330000000");
        order1.put("orderTag", big10);

        cache.put(big10,order1);

Data Mapping in Coherence Reference Map Type

The Map type coherence reference maps with the cache data in the key-value format. Key is object type and value is Map<String,Object>. Map<String,Object> is a map of attribute names and values. The attributes list should match with external event type. GGSA currently supports only external schema for key and value. Only single value equality join is supported.

Data Mapping in Coherence Reference POJO Type

The POJO type coherence reference maps with the cache date in the format Map<String, Object>.

Note:

When you upload the POJO in a jar, you must ensure that the fully-qualified class name of POJO matches exactly in cache and the custom POJO jar.

For example, if you have loaded com.company.CustomPOJO objects in cache, custom JAR should have CustomPOJO class inside the com.company package.

If there any mismatch in the class name, then querying the cache for certain type of objects, does not return a result and you will not see any data in the live output table.

Datatypes Supported in Correlation Conditions

POJO Coherence Reference supports only some data types as join keys, in correlation conditions.

Data types that are supported:
  • Java.lang.String (Interval and Interval YM)

  • java.math.BigDecimal (Number)

  • Java.lang.String (Text)

  • int (Integer)

  • Java.lang.Integer (Integer)

  • Java.lang.Long (BigInteger)

  • long (BigInteger)

  • java.sql.Timestamp (Timestamp)

  • double (Double)

  • Java.lang.Double (Double)

  • float (Float)

  • Java.lang.Float (Float)

  • boolean (Boolean)

  • Java.lang.Boolean (Boolean)

  • Java.math.BigInteger

Data types that are not supported:
  • char[]

  • char

  • BigInteger

  • oracle.spatial.geometry.JGeometry(SDO Geometry)

  • java.sql.Date (Timestamp)

Sample POJO Cache Loading in Coherence

The following is a sample POJO cache loading in coherence:

NamedCache<Integer, Object> cache = CacheFactory.getCache

	("externalcachepojo");

	private void preseedCoherencePOJOReferenceData(NamedCache<Integer, 

	Object> cache) {

	OrderPOJO order1 = new OrderPOJO(1,"HP Deskjet v2");
	OrderPOJO order2 = new OrderPOJO(2,"Oracle Database 12");
	OrderPOJO order3 = new OrderPOJO(3,"Apple iPhone6s");
	OrderPOJO order4 = new OrderPOJO(4,"Logitech Mouse");
	cache.put(1, order1);
	cache.put(2, order2);
	cache.put(3, order3);
	cache.put(4, order4);
	}

For this example coherence reference should be created with cache name as externalcachepojo and can join with stream with orderid.

Sample POJO Class

public class OrderPOJO implements Serializable{
private String orderId ;
Private String orderDesc;

public String setOrderId(String str1) {
         this.orderId=str1;
}
public String setOrderDesc(String str2) {
        this.orderDesc=str2;
}

public String getOrderId() {
return orderId;
}
public String getOrderDesc() {
return orderDesc;
}
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
if (!super.equals(object)) return false;
OrderPOJO that = (OrderPOJO) object;
return java.util.Objects.equals(orderId, this.orderId) &&
java.util.Objects.equals(orderDesc, this.orderDesc);
}
public int hashCode() {
return java.util.Objects.hash(super.hashCode(), orderId, orderDesc);
}
}

Note:

Ensure that the POJO class does not have a GGSA coherence target as a constructor, because it can instantiate the POJO class using default constructor, and then access the setXXX and getXXX, and isXXX methods.