初歩的な質問ですが、読んでいただきありがとうございます。そこで、次のようなレプリケートされたリージョンで Geode サーバー キャッシュ プロセスを開始します。
gfsh>start locator --name=myLocator
およびサーバープロセス
start server --cache-xml-file=D:\Geode\config\cache.xml --name=myGeode --locators=localhost[10334]
cache.xml は、複製された領域を定義しました。myRegion
<?xml version="1.0" encoding="UTF-8"?>
<cache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://geode.apache.org/schema/cache"
xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
version="1.0">
<cache-server/>
<region name="myRegion" refid="REPLICATE"/>
</cache>
次に、Pivotal Native Client for .Net を使用しています。別のプロセスで、次のようにキャッシュ イベント リスナーを使用してクライアント キャッシュを起動します。
CacheFactory cacheFactory = CacheFactory.CreateCacheFactory();
Cache cache = cacheFactory.SetSubscriptionEnabled(true).Create();
RegionFactory regionFactory = cache.CreateRegionFactory(RegionShortcut.CACHING_PROXY);
IRegion<string, string> region = regionFactory.Create<string, string>("myRegion");
region.AttributesMutator.SetCacheListener(new MyEventHandler<string, string>());
MyEventHandler は次のとおりです。
public class MyEventHandler<TKey, TVal> : ICacheListener<TKey, TVal>
{
public void AfterCreate(EntryEvent<TKey, TVal> ev)
{
Console.WriteLine("Received AfterCreate event for: {0}", ev.Key.ToString());
}
...
}
次に、3 番目のプロセスで、そのプロセス用に別のキャッシュを作成して、データを .csv に入れますmyRegion
。これは、リスナーのない 2 番目のプロセスと同じセットアップです。
CacheFactory cacheFactory = CacheFactory.CreateCacheFactory();
Cache cache = cacheFactory.SetSubscriptionEnabled(true).Create();
RegionFactory regionFactory = cache.CreateRegionFactory(RegionShortcut.CACHING_PROXY);
IRegion<string, string> region = regionFactory.Create<string, string>("myRegion");
region["testKey"] = "testValue";
問題は、3 番目のプロセスがテスト データを入れた後myRegion
(サーバー上で確認できるため、動作している)、2 番目のプロセスのリスナーがそれを認識しないことです。私は何が欠けていますか?
ありがとう...