xa transaction with CMT - jboss5.x

Recently I am involved in dealing with distributed transaction with JBoss 5.1 wherein Container Managed Transaction is used. But my worry is I am not understanding how different xa-resources are participating in the distributed transaction managed by JBossTS transaction manager. Basically I am looking for what are the transaction boundaries. And where I should put my code which I want to be executed as part of the transaction ? And also how container would understand which bean belongs to which xa-datasource.
I have already googled and tried to get something from JBoss documentation but couldn't find anything useful.
I already know how to configure datasources and transaction manager.
Any help would be appreciated.
Thanks in advance.

I got the answer. It was answered by Wolf-Dieter Fink. It's here

Related

Setting up Cygnus-PostgreSQL for historical data persistance

Now that I have a real device (LWM2M -using wakaama implementation) running and sending data to Orion (I can confirm from server log, 'Observers created successfully'), I want to proceed with historical data storage.
I am not sure how to start. Using docker-compose file to start all services. I already have postgres image pulled and running. Would like to use it for persistence.
I guess I need to create the db schema to use for storage, any link to cygnus-postgres installation/persistence would be appreciated.
Should anyone be looking for how to go about similar situation as I did (above refers), I found the explanations here the customisations section very helpful, please read it.

How to rollback on micro service when some http requests are successful and some http requests are fail by using jdbcTemplate

I have spring boot projects built on micro service and use KONG as api-gateway. All services are in Docker container.
In my situation, I use serviceA loop 20 times to request to delete records in serviceB by using jdbcTemplate. The first 10 requests are successful. So 10 records are deleted from postgresql database in serviceB. But the 11th request is error. So I would like to rollback all 10 records that were deleted successfully from database.
My question is that could I rollback in this situation? If it is possible to rollback, how can I do? and which technology should I use? Could I use Spring cloud stream and Kafka in this situation to rollback?
One option is to use distributed transactions, which is quite heavy approach...
Other then that you can change architecture, which is also not perfect advise.
Going to some real advises.
General question here is, if that is the only, problematic case. If so - that is quite easy - extend your API in the way that allows multi delete in one operation. Please look at Oracle/Scim API. So changing single group is atomic. Problem starts, when someone with to move user from one group to the other. So maybe you can deal with problematic cases by adding special method - like presented patch?
Other then all of that. You can use command design pattern and have revert for each operation. That is still tricky since not all reverts are possible, but that highly depends on your case.
UPDATE
There is something like Saga pattern. For particular operations there is revert operation prepared. And there is manager who knows what went wrong, and which reverts are required. Here is article for that. Sometimes it works, but... reversals are really problematic operations - like sending email. :)

Memcached Fault-Tolerance and failover property

As mentioned on this page: Memcached for PHP and failover,
I am trying to test the failover of Memcached.
Basically, I want to ensure that if one of the server is marked dead, subsequent sets and gets should get re-distributed to the servers that are left over.
Someone mentioned on this page that OPT_AUTO_EJECT_HOSTS is one option to achieve this.
However, It seems that Memcached::OPT_AUTO_EJECT_HOSTS is depreciated as decribed on this page:http://hoborglabs.com/en/blog/2013/memcached-php
I tried using OPT_REMOVE_FAILED_SERVERS option also. But this makes no difference.
I also tried OPT_SERVER_FAILURE_LIMIT, setting it to 1.
Benchmark/request generator in my case, is BRUTIS.
https://code.google.com/p/brutis/
I'm using libmemcached-1.0.16, memcached-1.4.15, and the php version of memcached is 2.1.0.
What should I do to make the failover and automatic rebalancing to work.
I am trying different combinations of these options also. But, it does not work.
There is a related question:
Brutis and memcached FailOver
But no answer yet :(
If anyone has any idea about this, please share your views.
Thanks in advance,
Amit

Handling the 'Faulted' state of a Workflow

I'm wondering how best to handle the Faulted state in a WF4 workflow service host. I'm using a console self-hosted service. I understand one approach is to implement the IErrorHandler interface, but does anybody know how I then configure this on my service? i.e. How do I add to the Behaviors collection?
Additionally, I wonder if anybody had any thoughts/advice on how best to handle a 'restart' scenario (or indeed if it's possible??) once the workflow service host has entered the Faulted state. My understanding is that once the service host enters the faulted state then it is end game and the application is in effect terminated. Can anybody give me a possible strategy for this? I'm thinking maybe a management service on top that handles failed instances of the workflow service host console application - though I'd be interested to hear from people who've faced this dilemma before, before I attempt anything.
EDIT:
Also, I'm working in a clustered environment. When the cluster enters a fail-over state, the workflow appears to lose connectivity with the database for a period of (no more than) one minute. Has anybody dealt with this scenario specifically?
Thanks in advance
Ian
We have a solution with Microsoft.Activities v1.8.4 see WorkflowService Configuration Based Extensions which allows you to add extensions using a service behavior and some config.

Purpose of JBoss tables

Can anyone point me in the direction of some documentation (or provide the information here) about the following tables, created by JBoss 5.1.0 when it starts up?
I know what they are for at a high level, and know why they are there, but I could do with some lower-level documentation about each table's purpose.
The tables are:
hilosequences
timers
jbm_counter
jbm_dual
jbm_id_cache
jbm_msg
jbm_msg_ref
jbm_postoffice
jbm_role
jbm_tx
jbm_user
I know that the first two are associated with uuid-key-generator and the EJB Timer Service respectively, while the rest are associated with JBoss Messaging. What I want to know is something along the lines of "jmg_msg stores each message when it is created...", that kind of thing.
Thanks
Rich
ps: I originally asked this question at ServerFault but didn't get a response
hilosequences is used by the uuid-key-generator.sar which provides the jboss:service=KeyGeneratorFactory,type=HiLo service, which basically allows you to have UUID keys consistently across all aplications of an instance
timers is used by ejb2-timer-service.xml, a legacy timer service
and the jbm* tables are used by JBoss Messaging (JMS) to store messages, queues, etc, which is why it's strongly recommended to change the DB from the default (Hypersonic) to a production ready one