Toby Shepheard
Toby Shepheard

Reputation: 131

Using deploymentSpi in Apache Ignite to load data and filter class

I'm trying to use Apache Ignite with a thin client written in Scala. I'm storing a data object in a cache

case class DataObject(uuid: UUID, name: String, timestamp: ZonedDateTime, data: Map[String,String]

and want to filter on the data using an IgniteBiPredicate. Per the docs I've defined this as it's own class and not as an anonymous inner class:

class DataFilter(uuid: Option[UUID], name: Option[String]) extends IgniteBiPredicate[UUID, DataObject]: Boolean = ??? // definition not relevant

If I run a ScanQuery using an instance of the filter, the Ignite server needs to have a definition of the classes locally. One way to do this is to add it to the server classpath; if I copy my jar file to the libs folder of apache ignite and restart the server then this all works great (I've also copied the scala library jar).

However, it's my understanding from the docs that I should also be able to remove my jar file from the libs folder (leaving the scala one in there) and then use either peerDeployment or the deploymentSpi to load my jar dynamically and pick up changes on the fly, but neither approach appears to work. Have I misunderstood or am I doing something wrong?

I've got the following in my server ignite_config.xml:

    <property name="peerClassLoadingEnabled" value="true"/>   
    <property name="deploymentMode" value="CONTINUOUS"/>
    <property name="deploymentSpi">
        <bean class="org.apache.ignite.spi.deployment.uri.UriDeploymentSpi">
            <property name="temporaryDirectoryPath" value="C:\Temp"/>
            <property name="uriList">
                <list>
                    <value>file:////C:/Users/toby/myproject/build/libs</value>
                </list>
            </property>
        </bean>
    </property>

I can see the jar file getting copied to a new folder under c:\temp on startup but still get a ClassNotFoundException trying to run a ScanQuery with the filter. I've also noticed the jar file gets copied at startup but doesn't get updated on the fly if I rebuild the jar in the source location (default refresh time should be 5 seconds)

Should this be working or have I misunderstood and this functionality is only meant to work for Tasks? I did see a Jira regarding this not working with postgresql and wondered if it might be related?

Upvotes: 1

Views: 122

Answers (0)

Related Questions