Also for clarification I was planning to do it for a couple of replicated
caches.



On Tue, Nov 15, 2016 at 10:58 AM, Amit Pandey <amit.pandey2...@gmail.com>
wrote:

> Thanks John and Michael.
>
> I can use client/server no problem.
>
> However my reason to use an embedded Geode was that based on my experience
> with other memory Grids its always faster to have it embedded. And I have
> some requirements for extremely low latency so I thought it would have
> saved some time and given better latency than having the client/server
> model.
>
> On Tue, Nov 15, 2016 at 9:15 AM, John Blum <jb...@pivotal.io> wrote:
>
>> @Mike - correct me if I am wrong, and I wouldn't recommend this, but...
>>
>> You could emulate a pub/sub system even with peers by taking advantage of
>> a Subscription
>> <http://geode.incubator.apache.org/docs/guide/reference/topics/cache_xml.html#subscription-attributes>
>>  [1]
>> policy on peer *Regions* (REPLICATE or PARTITION, either or).  I.e. a
>> Region's Subscription policy controls what data is replicated between them,
>> which in effect, could serve a similar purpose to topics and what data
>> events a peer Region receives.  Then a CacheListener registered on the
>> Region could process events when entries (of interests expressed through
>> the Region Subscription policy) are updated.
>>
>> Of course, this is a superficially limited approach and not advisable for
>> any practical use of a Region's Subscription policy, IMO.  First, you would
>> need to pre-populate the Region with keys (for events) you are interested
>> in.  Then, you would set the Subscription interest-policy to
>> "cache-content" where your peer would then be notified of updates from any
>> other peer also defining the same Region and, as well, also storing the
>> same key/value.  So, as you can see, this is not a intended use of this
>> feature, but it is doable.  You can read additional information here
>> <http://geode.incubator.apache.org/docs/guide/developing/events/configure_p2p_event_messaging.html>
>>  [2].
>>
>> As @Mike points out, a better approach it to use the client/server
>> topology
>> <http://geode.incubator.apache.org/docs/guide/topologies_and_comm/cs_configuration/chapter_overview.html>
>>  [3]
>> and Register Interests
>> <http://geode.incubator.apache.org/docs/guide/developing/events/configure_client_server_event_messaging.html>
>>  [4],
>> or better yet, use CQs
>> <http://geode.incubator.apache.org/docs/guide/developing/continuous_querying/chapter_overview.html>
>>  [5].
>>
>> Hope this helps.
>>
>> Cheers,
>> John
>>
>>
>> [1] http://geode.incubator.apache.org/docs/guide/reference/t
>> opics/cache_xml.html#subscription-attributes
>> [2] http://geode.incubator.apache.org/docs/guide/developing/
>> events/configure_p2p_event_messaging.html
>> [3] http://geode.incubator.apache.org/docs/guide/topologies_
>> and_comm/cs_configuration/chapter_overview.html
>> [4] http://geode.incubator.apache.org/docs/guide/developing/
>> events/configure_client_server_event_messaging.html
>> [5] http://geode.incubator.apache.org/docs/guide/developing/
>> continuous_querying/chapter_overview.html
>>
>>
>> On Mon, Nov 14, 2016 at 2:57 PM, Michael Stolz <mst...@pivotal.io> wrote:
>>
>>> Ok Got it.
>>> But Peer caches can't do pub/sub unless they go to the extra trouble of
>>> setting up a pool, whereas clients get a pool automatically.
>>>
>>> --
>>> Mike Stolz
>>> Principal Engineer, GemFire Product Manager
>>> Mobile: 631-835-4771
>>>
>>> On Mon, Nov 14, 2016 at 3:02 PM, John Blum <jb...@pivotal.io> wrote:
>>>
>>>> Well, what I think Amit means (correct me if I am wrong) is the Geode
>>>> embedded peer cache use case, meaning the application is also a peer cache
>>>> in the cluster, while not the most common UC (nor maybe recommended in most
>>>> UCs), it is a valid UC none-the-less.
>>>>
>>>> It is to have your application participate a peer in the Geode cluster
>>>> by simply constructing a peer Cache using the CacheFactory
>>>> <http://geode.incubator.apache.org/releases/latest/javadoc/org/apache/geode/cache/CacheFactory.html>
>>>>  [1],
>>>> and setting the locators property have your application join existing
>>>> cluster, something like so...
>>>>
>>>> Cache peerCache = new CacheFactory().set("locators",
>>>> "<host>[<port>]").set(..)...create();
>>>>
>>>> You can also do this in SDG with...
>>>>
>>>> <util:properties id="geodeProperties">
>>>>  <prop key="name">MyApplication</prop>
>>>>  <prop key="mcast-port">0</prop>
>>>>  <prop key="log-level">${geode.log.level:config}</prop>
>>>>  <prop key="locators">${geode.locators.host-port:localhost[10334]}</
>>>> prop>
>>>>  <prop key="start-locator">${geode.locator.embedded.host-port:}</prop>
>>>> </util:properties>
>>>>
>>>> <gfe:cache properties-ref="geodeProperties"/>
>>>>
>>>> The <gfe:cache> element created a "peer" cache (as opposed to the
>>>> <gfe:client-cache> element).
>>>>
>>>> You are then free to create Regions used by your application as
>>>> necessary.
>>>>
>>>> I have examples of both GemFire peer and client/server configurations
>>>> here <https://github.com/jxblum/pivotal-gemfire-clientserver-examples> [2]
>>>> and here
>>>> <https://github.com/jxblum/contacts-application/tree/apache-geode> [3]
>>>> (see configuration examples).
>>>>
>>>> Hope this helps.
>>>>
>>>> Cheers,
>>>> John
>>>>
>>>> [1] http://geode.incubator.apache.org/releases/latest/javado
>>>> c/org/apache/geode/cache/CacheFactory.html
>>>> [2] https://github.com/jxblum/pivotal-gemfire-clientserver-examples
>>>> [3] https://github.com/jxblum/contacts-application/tree/apache-geode
>>>>
>>>>
>>>> On Mon, Nov 14, 2016 at 11:28 AM, Michael Stolz <mst...@pivotal.io>
>>>> wrote:
>>>>
>>>>> Geode clients have the ability to registerInterest(key) which works a
>>>>> lot like a topic.
>>>>>
>>>>> Not sure what you mean by using Geode embedded and with a cluster of
>>>>> external processes, but what I THINK you're asking is, can you use the
>>>>> Geode client/server model where the client is embedded into your
>>>>> application process and the servers that are responsible for holding all
>>>>> the data are in a separate cluster. The answer is YES, that is the most
>>>>> common configuration for Geode usage.
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Mike Stolz
>>>>> Principal Engineer, GemFire Product Manager
>>>>> Mobile: 631-835-4771
>>>>>
>>>>> On Sat, Nov 12, 2016 at 12:41 PM, Amit Pandey <
>>>>> amit.pandey2...@gmail.com> wrote:
>>>>>
>>>>>> Hi Guys,
>>>>>>
>>>>>> Is there any example of public subscribe with geode?  Hazelcast and
>>>>>> Ignite seem to have topics, is there any such thing in Geode.
>>>>>>
>>>>>> Also I want to use Geode embedded. Can I use it with a cluster of
>>>>>> external processes as well.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> -John
>>>> 503-504-8657
>>>> john.blum10101 (skype)
>>>>
>>>
>>>
>>
>>
>> --
>> -John
>> 503-504-8657
>> john.blum10101 (skype)
>>
>
>

Reply via email to