@Override
    public <T> void setProperty(final String namespace, final String propertyName, final T value, final IAsyncResultHandler<Void> handler) {
        if (value == null) {
            handler.handle(AsyncResultImpl.<Void>create(new Exception("Null value is not allowed."))); //$NON-NLS-1$
            return;
        }
        String source;
        try {
            if (value.getClass().isPrimitive() || value instanceof String) {
                PrimitiveBean pb = new PrimitiveBean();
                pb.setValue(String.valueOf(value));
                pb.setType(value.getClass().getName());
                source = JSON_MAPPER.writeValueAsString(pb);
            } else {
                source = JSON_MAPPER.writeValueAsString(value);
            }
        } catch (Exception e) {
            handler.handle(AsyncResultImpl.<Void>create(e));
            return;
        }

        String id = getPropertyId(namespace, propertyName);
        String json = source;
        IndexRequest indexRequest = new IndexRequest(getFullIndexName()).source(json, XContentType.JSON).id(id);

        try {
            getClient().index(indexRequest, RequestOptions.DEFAULT);
            handler.handle(AsyncResultImpl.create((Void) null));
        } catch (Throwable e) {
            handler.handle(AsyncResultImpl.<Void>create(e));
        }
    }
@see io.apiman.gateway.engine.components.ISharedStateComponent#setProperty(java.lang.String, java.lang.String, java.lang.Object, io.apiman.gateway.engine.async.IAsyncResultHandler)
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/EsSharedStateComponent.java