Getting null query output after using QueryEntity - ignite

I have written following query entity for my database. I provide this file to ignite server node for index mapping. Loading part of data is done through ignite client node.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="peerClassLoadingEnabled" value="false"/>
<property name="cacheConfiguration">
<list>
<!-- Partitioned cache example configuration (Atomic mode). -->
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="warehouse_cache"/>
<property name="backups" value="0"/>
<property name="copyOnRead" value="true"/>
<property name="memoryMode" value="ONHEAP_TIERED"/>
<property name="cacheMode" value="PARTITIONED"/>
<!-- Configure query entities -->
<property name="queryEntities">
<list>
<bean class="org.apache.ignite.cache.QueryEntity">
<property name="keyType" value="java.lang.Long"/>
<property name="valueType" value="schema.warehouse"/>
<property name="fields">
<map>
<entry key="w_id" value="java.lang.Integer"/>
<entry key="w_name" value="java.lang.String"/>
<entry key="w_street_1" value="java.lang.String"/>
<entry key="w_street_2" value="java.lang.String"/>
<entry key="w_city" value="java.lang.String"/>
<entry key="w_state" value="java.lang.String"/>
<entry key="w_zip" value="java.lang.String"/>
<entry key="w_tax" value="java.lang.Double"/>
<entry key="w_ytd" value="java.lang.Double"/>
</map>
</property>
<property name="indexes">
<list>
<bean class="org.apache.ignite.cache.QueryIndex">
<constructor-arg value="w_id"/>
</bean>
</list>
</property>
</bean>
</list>
</property>
</bean>
</list>
</property>
</bean>
</beans>
All entries of this warehouse table gets loaded correctly(verified using ignitevisorcmd.sh). For this query entity I have created jar file of package schema, which contains warehouse class. I kept this jar file in libs folder in apache ignite installation path. When I run query against this warehouse table, I am getting null output. Why is this happening?

The value type in configuration looks suspicious:
<property name="valueType" value="schema.warehouse"/>
Make sure that this value is correct value class name. Also what query are you executing?

Related

Is it possible to run a single instance apache ignite configuration? Or must there be multiple instances clustered together?

I'm using Ignite as a Hibernate L2 Cache Provider on a single-node/single-instance install, so I don't want any clustering or network communication going on. Is there a property I can set in IgniteConfiguration in the XML to disable networking/clustering?
Is it possible to run Apache Ignite as a single instance only?
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<!--
Specify the name of the caching grid (should correspond to the
one in Hibernate configuration).
-->
<property name="gridName" value="hibernate-grid"/>
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="dataRegionName" value="object"/>
<property name="name" value="object"/>
<property name="cacheMode" value="LOCAL"/>
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Enabling on-heap caching for this cache. -->
<property name="onheapCacheEnabled" value="true"/>
<property name="evictionPolicy">
<!-- LRU eviction policy. -->
<bean class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicy">
<property name="maxSize" value="5000"/>
</bean>
</property>
</bean>
</list>
</property>
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<property name="dataRegionConfigurations">
<list>
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="name" value="object"/>
<property name="initialSize" value="#{1L * 1024 * 1024 * 1024}"/>
<property name="maxSize" value="#{4L * 1024 * 1024 * 1024}"/>
</bean>
</list>
</property>
</bean>
</property>
</bean>
I keep getting this:
SEVERE: Failed to request nodes addresses.
java.net.SocketException: bad argument for IP_MULTICAST_IF: address not bound to any interface
at java.net.PlainDatagramSocketImpl.socketSetOption(Native Method)
at java.net.AbstractPlainDatagramSocketImpl.setOption(AbstractPlainDatagramSocketImpl.java:309)
at java.net.MulticastSocket.setInterface(MulticastSocket.java:466)
at org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder.requestAddresses(TcpDiscoveryMulticastIpFinder.java:565)
at org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder.access$700(TcpDiscoveryMulticastIpFinder.java:80)
at org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder$AddressReceiver.body(TcpDiscoveryMulticastIpFinder.java:780)
at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)
Why not just use org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder with sole 127.0.0.1 address?
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<value>127.0.0.1:47500</value>
</list>
</property>
</bean>
</property>
</bean>
</property>

dynamic VFS endpoint

I need to create folder on storage. The folder name is dynamic and comes from incoming request. I tried with concatenated full path in property 'transport.vfs.ReplyFileName' without success and still use the uri property in the address endpoint:
<property description="concat path and DestinationFolder" expression="fn:concat(get-property('path'),get-property('DFolder'))" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>
<property description="OUT_ONLY=true" name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<endpoint>
<address uri="vfs:file://D:\\temp_WSO2\\Downloads\\">
</address>
</endpoint>
Anyone with idea how to solve that situation?
Thanks in advance!
You can use the To header property to set a dynamic path. Your can then contain an anonymous endpoint.
<header name="To" expression="fn:concat(get-property('path'),get-property('DFolder'))"/>
<property description="OUT_ONLY=true" name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<send>
<endpoint>
<default/>
</endpoint>
</send>
You can see examples on the WSO2 documentation.

Why am I unable to Send messages to ActiveMQ from WSO2 EI 6.0.0?

I followed the link ESB as a JMS Producer to configure the sender and receiver. I have also placed the following jars activemq-broker-5.8.0.jar activemq-client-5.8.0.jar activemq-kahadb-store-5.8.0.jar
geronimo-jms_1.1_spec-1.1.1.jar geronimo-j2ee-management_1.1_spec-1.0.1.jar geronimo-jta_1.0.1B_spec-1.0.1.jar hawtbuf-1.9.jar Slf4j-api-1.6.6.jar activeio-core-3.1.4.jar into WSO2_EI_HOME/lib
When I configured a proxy with the following code and tried to send the messages to the queue, but the messages aren't delivering.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Sender"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<send>
<endpoint>
<address uri="jms:/VALLYSOFTQ?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy>
The same configuration worked earlier for me but I don't know what happened, the messages are not going to the queue now.
Thanks in advance.

How to get the response of a rest call inside the api in WSO2 ESB?

I am calling the rest service as sown in below
<resource methods="GET" url-mapping="/getallpayments" faultSequence="error_handler_">
<inSequence>
<log level="custom">
<property name="CashreceiptsService" value="**************Entered into getallpayments*************"/>
<property name="Request Payload" expression="get-property('JSON_OBJECT')"/>
</log>
<property name="HTTP_METHOD" value="GET" scope="axis2" type="STRING"/>
<property name="messageType" value="application/json" scope="axis2"/>
<oauthService remoteServiceUrl="https://localhost:9443/services/OAuth2TokenValidationService/" username="admin" password="admin"/>
<log level="custom">
<property name="CashreceiptService" value="^^^^^^^^^^^^OAUTH COMPLETED^^^^^^^^^^^^"/>
<property name="User Name******" expression="get-property('username')"/>
</log>
<send>
<endpoint>
<http format="rest" method="GET" uri-template="http://localhost:8080/rest/commonService/getallpayments"/>
</endpoint>
</send>
<drop/>
</inSequence>
It will gives the below response
[{"typeId":1,"name":"Entity_Type","value":"EMPLOYER","description":"Employer","createdDate":"08/12/2013","tenantId":0,"hasPhiFields":false},{"typeId":2,"name":"Entity_Type","value":"BROKER","description":"Broker","createdDate":"08/12/2013","tenantId":0,"hasPhiFields":false}]
I am able to get the above response in the UI.
But i need the response of "typeId" inside the Api and that typeId i need to get and pass to the another service as a input parameter and this service will give the final response to the UI.
Right now i am implementing using the service chaining.
Main issue is how to get the response of one service and pass to another service as input param? please suggest me, i am new to WSO2 ESB.
And also how to get the POST data send by user?
you may grab the values in out sequence else any other sequence for getting response from their you may send to another endpoint or proxy or any endpoint
in your case you get the values in out sequence or any other sequence u need adopt particuler object like this
<property xmlns:f="http://ws.wso2.org/dataservice" xmlns:ns="http://org.apache.synapse/xsd" name="typeid" expression="//f:typeid/text" scope="default" type="STRING"/>
or else u define as per your endpoint
<send receive="someothersequencename">
<endpoint>
<http format="rest" method="GET" uri-template="http://localhost:8080/rest/commonService/getallpayments"/>
</endpoint>
</send>
then u will get all response in this sequence

Where to configure NLog NHibernate bridge for logging sql configuration?

As a proof-of-concept I am using a console application wrapping a proxy of a WCF service. I execute a few calls through the proxy and write the results to the console. Underlying the WCF service is a Data Access Layer built on the Repository pattern using NHibernate as an ORM. I want to write the NHib-generated SQL to the console.
I have attempted to configure NLog using the NuGet package and guidance from here with no luck, but I suspect perhaps I don't properly understand where I need to perform these different configuration bits in my many-layered architecture. Here's an attempt at describing my layout:
Solution
|
-- WCF Service
|
-- DAL
| | (NHibernate is used here)
| -- hibernate.cfg.xml
| NLog.config
| App.config (r)
-- WCF Client (console app)
|
--App.config (c)
hibernate.cfg.xml contents:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql2012Dialect</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="show_sql">true</property>
<property name="connection.connection_string">Data Source=.\SQLEXPRESS;Initial Catalog=AdventureWorks2012;User ID=**;Password=********</property>
</session-factory>
</hibernate-configuration>
NLog.config contents:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="trace" type="Trace" />
</targets>
<rules>
<logger name="NHibernate.SQL" writeTo="trace" />
</rules>
</nlog>
App.config (r) contents:
<configuration>
<appSettings>
<add key="nhibernate-logger" value="NHibernate.NLogLoggerFactory, NHibernate.NLog" />
</appSettings>
</configuration>
App.config (c) contents:
<configuration>
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add name="consoleListener" type="System.Diagnostics.ConsoleTraceListener" />
</listeners>
</trace>
</system.diagnostics>
<appSettings>
<add key="nhibernate-logger" value="NHibernate.NLogLoggerFactory, NHibernate.NLog" />
</appSettings>
</configuration>
My NUnit unit tests are displaying the SQL Statements, so the show-sql instruction in hibernate.cfg.xml is working correctly. If I insert a Trace.WriteLine() in my console app that shows up in the console, so (I expect) anything written to Trace ought to show up there. But I do not see any SQL in the console.
I'm assuming that I've placed some of my .config instructions in the wrong layers of my app, but where?