Gemfire WAN Gateway-senders/receivers members - gemfire

Within a cluster, we want to create members that are neither senders nor receivers, while having 1 sender/receiver in each cluster. We started up the sender/receiver in a given cluster first, no errors. As soon as we started up the member that's neither a sender nor a receiver, it raises this error:
java.lang.IllegalStateException: Cannot create Region /data with
[gateway-sender-A] gateway sender ids because another cache has the
same region defined with [] gateway sender ids.
Some assumptions:
- Replicated regions
- Serial gateway-senders
- manual-start is false for all gateway-senders
My guess is that since the member doesn't have a gateway-sender-id, it's complaining being blank, which I'm confused. I thought we can have members that are neither sender/receiver in a cluster. Can someone clarify?
Thanks

I assume you are using peer-to-peer configurations within a cluster, so all of these are peers but not clients. Then, the configuration for the same region needs to be identical, i.e. if member A has gateway sender 1, member B should have sender 1 in the gateway-sender-ids property.
This error will be thrown when the starting member figures out that somewhere in the cluster exists a region with the same name but not having the same configuration. And the error message tells the detailed reason.
To achieve "neither sender nor receiver", i think just simply not configure gateway sender/receiver on that specific instance will do.

Figured it out.
My old understanding was based on this graph,
Where the 2 top left members were neither senders/receivers. This is wrong. The graph is a little misleading.
You CAN set which members are receivers in cache xml but CAN NOT set
which members hosting the region are senders. In other words, having the tag in a member doesn't mean that member is the sender, it simply means that region has a sender in the cluster.
Therefore, if you want a sender for a specified region, you must include the <gateway-sender> tag in all the members under the specified region for it to be valid.

Related

Customer Reservations - <nameprefix>, does it exist in the Amadas API?

I troubleshooting an issue downstream of the GDS and I wanted to confirm if Amadas has an <namePrefix> XML object for customer reservation.
When that data is being ingested into its destination, this is what I would like to be seeing:
<IndividualName>
<namePrefix>Mr</namePrefix>
<nameFirst>FIRST</nameFirst>
<nameSur>SUR</nameSur>
But I'm seeing
<IndividualName>
<nameFirst>JOHN MR</nameFirst>
<nameSur>DOE</nameSur>
</IndividualName>
If they do, then I'll engage with the party between the GDS and our PMS to resolve the issue but I need to be sure if this XML object exists.
Regards
At this stage, I've traced the missing XML Object back to the stage before the GDS.
If the XML object is not present as an XML object, I'll engage the destination vendor to work on a solution.
Our Current Flow
GDS - Does <nameprefix> exist?
Parent Hotel Company - NamePrefix does not exist when it flows downstream.
Site Minder - Is only a passthrough. Nothing is changed
Destination (Opera Cloud) - NamePrefix XML Does not exist when ingested

Gemfire WAN with Peer to Peer combined

We are using the multi-site WAN configuration. We have two clusters across geographical distances in North America and Europe.
Context: Cluster 1 has two members A and B that are both gateway senders. Cluster B has two members C and D that are both gateway receivers. When member A in cluster 1 starts, it reads data from database and loads it into the gemfire cache which gets sent to the cluster 2. Everything so far is good.
Problem: If both members in Cluster 2 are restarted at the same time, they lose all the gemfire regions/data. At that point, we could restart member A in cluster 1, it again loads data from the DB and gets pushed to cluster B. But we would prefer to avoid the restart of member A and without persisting to hard disk.
Is there a solution where if cluster 2 is restarted, it can request a full copy of data from cluster 1?
Not sure if it's possible, but could we somehow setup peer to peer for the gateway receivers in cluster 2 (on top of WAN), so they would be updated automatically upon restart.
Thanks
Getting a full copy of data over WAN is not supported at this time. What you could do instead is run a function on all members of site A, that simply iterates over all data and puts it back again in the region. i.e something like:
public void execute(FunctionContext context) {
RegionFunctionContext ctx = (RegionFunctionContext)context;
Region localData = PartitionRegionHelper.getLocalDataForContext(ctx);
for (Object key : localData.keySet()) {
Object val = localData.get(key);
localData.put(key, val);
}
}

Gemfire WAN Gateway-sender configuration

We are using the Gemfire WAN topology and have problems setting up the gateway-senders.
Couple of assumptions:
- Replicated regions
- Serial gateway-senders
- manual-start is false for all gateway-senders
Let's say we have 2 clusters, within each cluster, we have 2 members (Member A and Member B)
Member A's cache.xml
<gfe:gateway-sender id="gateway-sender-A" parallel="false" remote-distributed-system-id="2" manual-start="false" />
<gfe:replicated-region name="data" scope="DISTRIBUTED_NO_ACK">
<gfe:replicated-region name="subData" data-policy="REPLICATE" scope="DISTRIBUTED_ACK">
<gfe:gateway-sender-ref bean="gateway-sender-A"/>
</gfe:replicated-region>
</gfe:replicated-region>
Member B's cache.xml
<gfe:gateway-sender id="gateway-sender-B" parallel="false" remote-distributed-system-id="2" manual-start="false" />
<gfe:replicated-region name="data" scope="DISTRIBUTED_NO_ACK">
<gfe:replicated-region name="subData" data-policy="REPLICATE" scope="DISTRIBUTED_ACK">
<gfe:gateway-sender-ref bean="gateway-sender-B"/>
</gfe:replicated-region>
</gfe:replicated-region>
There is a problem when we run start up the two members within one cluster. It raises this error:
java.lang.IllegalStateException: Cannot create Region /data with [gateway-sender-A] gateway sender ids because another cache has the same region defined with [gateway-sender-B] gateway sender ids
Looking at the "High Availability for Gateway Senders" documentation, our understanding is that we can create 2 gateway-senders, in which only one will be doing the sending at a given point in time. Ultimately, we want to have 2 gateway senders (one in each member) for one cache region, one as the primary sender and the other as the secondary sender.
Thanks
From Geode documentation, it says
For serial Senders, Queue HA is achieved by configuring identical serial Senders in multiple members. The Queue is replicated between the members.
So if the two gateway senders in member A and B is doing the same job (except their primary/secondary roles), you should use "identical" setting.
Among gateway senders, there will be one that manages to acquire a specific distributed lock and becomes the primary sender, usually the first one comes up. I don't see a property to force one to become primary.
Geode is the open source version of Gemfire if you wonder.
After changing the sender-ids to the same for both members, we have another problem:
java.lang.IllegalStateException: Cannot create Gateway Sender
"some-gateway-sender-id" with manual start "false" because another
cache has the same Gateway Sender defined with manual start "true
It seems like our problem was the inconsistent format.
Member A used XML format
<?xml version="1.0"?>
<!DOCTYPE cache PUBLIC "-//GemStone Systems, Inc.//GemFire Declarative Caching 8.0//EN" "http://www.gemstone.com/dtd/cache8_0.dtd">
Member B used Spring Gemfire Data format
xmlns:gfe="http://www.springframework.org/schema/gemfire" xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd">
<gfe:gateway-sender ...>
We switched to using the Spring Gemfire Data format for both members, and it solved both issues.
TL;DR, the gateway-senders need to have the same ids if they are in the same cluster and use consistent cache xml formats.

Topic and queue with the same name, classcastexception

my question is, using ActiveMQ can we have a topic and queue with the same name for jndi?.
I have both defined with the same name, and when I try to create a queue with lookup I´m receiving this exception.
java.lang.ClassCastException: org.apache.activemq.command.ActiveMQTopic cannot be cast to javax.jms.Queue
While you can actually have a topic and queue with the same name you cannot share a JNDI name between a topic and a queue. A JNDI name makes you lookup a single object (queue or topic).
So - make sure you have JNDI entries with unique names.
queue.MyQueue = samePhysicalName
topic.MyTopic = samePhysicalName
Although I think it's bad practice to share names, since it's harder to document, trouble shoot etc etc.

NServiceBus - How to control message handler ordering when Bus.Send() occurs on different threads / processes?

Scenario:
I have a scenario where audit messages are sent via NServiceBus. The handlers insert and update a row on a preexisting database table, which we have no remit to change. The requirement is that we have control over the order that messages are handled, so that the Audit data reflects the correct system state. Messages processed out of order may cause the audit data to reflect an incorrect state.
Some of the Audit data is expected in a specific order, however some can be received at any time after the initial message, such as a status update which will be sent several times during the process.
In my test project I have been testing using a server, (specifically the ISpecifyMessageHandlerOrdering functionality) with the end point configured as follows:
public class MyServer : IConfigureThisEndpoint, AsA_Server, ISpecifyMessageHandlerOrdering
{
public void SpecifyOrder(Order order)
{
order.Specify(First<PrimaryCommand>.Then<SecondaryCommand>());
}
}
Because the explicit order of messages is not known, one message, InitialAuditMessage is the initial message, and inherits from PrimaryCommand.
Other messages which are allowed to be received at a later stage inherit from SecondaryCommand.
public class StartAuditMessage : PrimaryCommand
public class UpdateAudit1Message : SecondaryCommand
public class UpdateAudit2Message : SecondaryCommand
public class ProcessUpdateMessage : SecondaryCommand
This works in controlling the handling order of messages where they are sent from the same thread.
This breaks down however, if the messages are sent from separate threads or processes, which makes sense as there is nothing to link the messages as related.
How can I link the messages, say through an ID of some sort so that they are not processed out of order when sent from separate threads? Is this a use case for Sagas?
Also, with regard to status update messages, how can I ensure that messages of the same type are processed in the order in which they were sent?
Whenever you have a requirement for ordered processing you cannot avoid the conclusion that at some point in your processing you need to restrict everything down to a single thread. The single thread guarantees the order in which things are processed.
In some cases you can "scale out" the single thread into multiple threads by splitting the processing by a correlating identifier. The correlation ID allows you to define a logical grouping of messages within which order must be maintained. This allows you to have concurrent threads each performing ordered processing which is more efficient.