Messaging Pattern

Hi,
Back Ground – We are building claim-processing system. Currently we are using AQ as a load balancer and spring MDP (in concurrent threads) that grabs the messages from the queue and start claim processing. I see in case heavy load the AQ can itself become a bottleneck and hence want to replace the AQ with Coherence and leverage the Messaging Pattern.
MDP – Message Driver Pojos
I have following questions on the Messaging Pattern
1.     Can the Coherence’s Messaging Pattern framework replace AQ?
2.     If answer to the above question is ‘yes’, how can we make ‘queue’ durable i.e. guarantee that no messages are lost.
3.     How many messages can be delivered per second using coherence?
Regards,
Gaurav Malhotra

Hi All,
I also integrated oracle coherence with spring integration. This enables the developer to work with pojos
Concept
Make a channel backed by oracle coherence as queue.
So I extended the queue channel as follows
>
public class CoherenceAwareQueueChannel extends QueueChannel {
     private final static String nameOfQueue = "aq";
     private NamedCache queueNamedCache = null;
     private NamedCache jmsIdNamedCache = null;
     public static final String JMS_ID_CACHE = "jmsMsgId";
     public static final String JMS_ID_KEY_GEN = "jmsIdKeyGen";
     public CoherenceAwareQueueChannel() {
          // do nothing
     public CoherenceAwareQueueChannel(int capacity) {
          // do nothing
     private NamedCache getQueueNamedCache() {
          if (queueNamedCache == null) {
               queueNamedCache = CacheFactory.getCache(nameOfQueue);
          return queueNamedCache;
     private long getJmsId() {
          long retVal = 0;
          getJmsNamedCache();
          JmsMsgId jmsMsgId = (JmsMsgId) jmsIdNamedCache.get(JMS_ID_KEY_GEN);
          if (jmsMsgId == null) {
               jmsMsgId = new JmsMsgId();
               retVal = jmsMsgId.getJmsId();
               jmsIdNamedCache.put(JMS_ID_KEY_GEN, jmsMsgId);
          } else {
               retVal = jmsMsgId.getJmsId();
               jmsIdNamedCache.put(JMS_ID_KEY_GEN, jmsMsgId);
          return retVal;
     private void getJmsNamedCache() {
          if (jmsIdNamedCache == null) {
               jmsIdNamedCache = CacheFactory.getCache(JMS_ID_CACHE);
     @Override
     public List<Message<?>> clear() {
          List<Message<?>> clearedMessages = new ArrayList<Message<?>>();
          Set<?> keys = getQueueNamedCache().keySet();
          for (Object key : keys) {
               clearedMessages.add((Message<?>) getQueueNamedCache().get(key));
          getQueueNamedCache().clear();
          return clearedMessages;
     @Override
     protected Message<?> doReceive(long timeout) {
          // What is the key? Top element of the key
          getJmsNamedCache();
          JmsMsgId jmsId = (JmsMsgId) jmsIdNamedCache.get(JMS_ID_KEY_GEN);
          Long currJmsId = jmsId.getCurrentJmsId();
          Assert.assertNotNull(currJmsId);
          Message<?> msg = (Message<?>) getQueueNamedCache().remove(currJmsId);
          jmsId.resetBy(1);
          jmsIdNamedCache.put(JMS_ID_KEY_GEN, jmsId);
          return msg;
     @Override
     protected boolean doSend(Message<?> message, long timeout) {
          Object jmsId = message.getHeaders().get(JmsHeaders.MESSAGE_ID); // take control
          Object id = (jmsId == null ? getJmsId() : jmsId);
          getQueueNamedCache().put(id, message,timeout);
          return true;
     @Override
     public int getQueueSize() {
          return queueNamedCache.size();
     @Override
     public int getRemainingCapacity() {
          return 999999999; // there is not limit
     @Override
     public List<Message<?>> purge(MessageSelector selector) {
          if (selector == null) {
               return this.clear();
          Set<?> keys = getQueueNamedCache().keySet();
          List<Message<?>> purgedMessages = new ArrayList<Message<?>>();
          for (Object key : keys) {
               Message<?> msg = (Message<?>) getQueueNamedCache().get(key);
               if (!selector.accept(msg) && this.getQueueNamedCache().remove(key) != null) {
                    purgedMessages.add(msg);
          return purgedMessages;
     public static class JmsMsgId implements ExternalizableLite {
          private static final long serialVersionUID = 1L;
          private long cnt = 0;
          public JmsMsgId() {
          public long getJmsId(){
               return ++cnt;
          public long getCurrentJmsId() {
               return cnt;
          public void resetBy(long cnt) {
               this.cnt = this.cnt - cnt;
          @Override
          public void readExternal(DataInput in) throws IOException {
               cnt = ExternalizableHelper.readLong(in);
          @Override
          public void writeExternal(DataOutput out) throws IOException {
               ExternalizableHelper.writeLong(out, cnt);
}My aq based cache store looks like
public class AqCacheStore extends AbstractCacheStore {
     @Autowired
     private JmsTemplate jmsTemplate;
     // TODO provide pluggable transformation strategy which convert CoherenceMessage to javax.jms.Message
     @SuppressWarnings("unchecked")
     @Override
     public void store(Object msgId, Object jmsMsg) {
          Assert.isTrue((jmsMsg instanceof GenericMessage));
          // TODO we should restrict the payload ad String
          jmsTemplate.send(JmsHelper.createJmsTextMessage(((GenericMessage) jmsMsg).getPayload().toString(),((GenericMessage) >jmsMsg).getHeaders().get(JmsHeaders.TYPE).toString()));
     @Override
     public Object load(Object msgId) {
          throw new IllegalArgumentException("Message should never be loaded..");
     @Override
     public void erase(Object msgId) {
          if (msgId != null) {
               jmsTemplate.receiveSelected("JMSMessageID = 'ID:" + msgId + "'");
          } else {
               jmsTemplate.receive();
     @Override
     public void eraseAll(Collection msgIds) {
          for (Object msgId : msgIds) {
               erase(msgId);
     @SuppressWarnings("unchecked")
     @Override
     public void storeAll(Map msgMap) {
          for (Iterator<Map.Entry> iter = msgMap.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = iter.next();
Object jmsMsg = entry.getValue();
jmsTemplate.send(JmsHelper.createJmsMessage(jmsMsg));
}My junit test cases looks like
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:com/oracle/aq/cachestore/junit/AqContext.xml" })
public class AqCacheStoreTest {
     @Autowired
     private AqCacheStore aqCacheStore;
     @Autowired
     private JmsTemplate jmsTemplate;
     @Autowired
     private QueueChannel coherenceQueue;
     @Autowired
     private PollingConsumer coherenceConsumer;
     @Test
     public void sendSIMsgToCoherenceQueueChannel() throws InterruptedException,
               JMSException {
          Assert.assertNotNull(aqCacheStore);
          Message<String> message = MessageBuilder.withPayload("gaurav in cache")
                    .setHeader(JmsHeaders.TYPE, "sometype").build();
          coherenceQueue.send(message);
          coherenceQueue.send(message);
     @Test
     public void recieveSIMsgFromCoherenceQueueChannel() {
          Assert.assertNotNull(aqCacheStore);
          Message<String> msg = (Message<String>) coherenceQueue.receive();
          System.err.println("^^^^^^^^^^^^^^^^^^^^^^^"+msg.getPayload());
          msg = (Message<String>) coherenceQueue.receive();
          System.err.println(">>>>>>>>>>>>>"+msg.getPayload());          
     public static class ServiceActivator {
          public void onMessage(Message<?> msg) {
               System.err.println("%%%%" + msg.getPayload());
}Conclusion
Message can be stored in both AQ and coherence and hence can be used for store and forward of messages, which are also persisted. I have used spring integration GenericMessage<T> and provide injectable strategy to convert to JMS message and visa versa Why??? javax.jms.Message is not serializable. By this we can leverage both power of bothcoherence and AQ. Also programming model encourages POJO driver coding and JMS specifications
Looking forward for the valuable feedback from the community.

Similar Messages

  • A bug in message pattern?

    We used a wrong cache factory class and seems to encounter a message pattern bug accidently...
    Here is the exception we got.
    java.util.MissingFormatArgumentException: Format specifier 's'
    at java.util.Formatter.format(Formatter.java:2431)
    at java.util.Formatter.format(Formatter.java:2366)
    at java.lang.String.format(String.java:2770)
    at com.oracle.coherence.common.logging.Logger.log(Logger.java:93)
    at com.oracle.coherence.patterns.messaging.MessagePublisher.initDestinationType(MessagePublisher.java:400)
    at com.oracle.coherence.patterns.messaging.MessagePublisher.<init>(MessagePublisher.java:133)
    at com.oracle.coherence.patterns.messaging.MessagePublisherManager.getPublisher(MessagePublisherManager.java:187)
    at com.oracle.coherence.patterns.messaging.MessagePublisherManager.ensurePublisher(MessagePublisherManager.java:98)
    at com.oracle.coherence.patterns.messaging.entryprocessors.PublishMessageProcessor.process(PublishMessageProcessor.java:118)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.invoke(DistributedCache.CDB:20)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache.onInvokeRequest(DistributedCache.CDB:49)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$InvokeRequest.run(DistributedCache.CDB:1)
    at com.tangosol.coherence.component.net.message.requestMessage.DistributedCacheKeyRequest.onReceived(DistributedCacheKeyRequest.CDB:12)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:9)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:136)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache.onNotify(DistributedCache.CDB:3)
    at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
    at java.lang.Thread.run(Thread.java:619)
    The interesting part is that the source code from message pattern website seems doesn't match with the jar file.
    We "decompile" coherence-messagepattern-2.6.1.14471.jar and the line numer 400 of MessagePublisher.class is
    Logger.log(1,"Destination %s is not found for Id "+this.destinationIdentifier, new Object[0]);
    * this is the one caused the exception since you can't provide Object[0] when you have %s in the format string expect an input.
    But if I look at the source code inside coherence-messagepattern-2.6.1.14471-src.zip from message pattern page, line 400 of MessagePublisher.class is
    Logger.log(1,"Destination %s is not found for Id "+this.destinationIdentifier);

    I encountered an identical issue. The root cause is bad logging in messaging.
    The reason it happens is items were put to a cache that is backed by a publishing cache store, but there are no publishers attached to that cache. The temporary fix is to either add one or more publishers to the cache, or to alter your coherence config so that this particular cache is not backed by a publishing cachestore.
    Cheers,
    Neville.

  • A bug in message pattern's queue implementation?

    Here is how to reproduce the problem.
    Have 2 Java program ready.
    A is to create a queue and publish 3 messages to the queue.
    B is to subscribe to the same queue and try to get all messages from the queue (put the getMessage inside a while(true) loop) then wait for new message.
    Step 1. Run A, which put 3 messages into queue.
    Step 2. Run B, which get 3 messages out of the queue then waiting on the getMessage() blocking call.
    Step 3. Kill program B without unsubscribe() call.
    Step 4. Run A, which put 3 messages into the queue again.
    Step 5. Run B, this time it only get 2 messages. The 1st message A put in on Step 4 got lost.
    Actually, if you run Step 2 multiple times before step 3, you will lost more message. It seems each time when there is a subscription created without a unsubscribe(), it will get one message lost.
    I know the propery way is to call unsubscribe(), but the JVM could be killed thus won't have time to do cleanup.

    Using message pattern 2.3, command pattern 2.3 and common 1.3
    Coherence version is 3.4.2.
    BTW, if the unit test program you mentioned is the MessageTests.java included in the src zip file, you won't be able to test this issue.
    All unit test inside the MessageTests.java are comsuming exactly number of messages been published then do unscribe() call.
    In order to reproduce this issue, you'd need to put your consumer JVM in a blocking getMessage() state (i.e. call getMessage() while there is no message in queue)
    then kill the JVM. The unit test codes in MessageTests.java never enter blocking wait state when call getMessage().
    Example code -
    For the one putting message
    MessagingSession messagingSession = DefaultMessagingSession.getInstance();
    Identifier topicIdentifier = messagingSession.createQueue("test-queue");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY1");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY2");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY3");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY5");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY5");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY5");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY5");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY5");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY5");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY1");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY2");
    messagingSession.publishMessage(topicIdentifier, "Hello WorldY3");
    For the one getting message
    MessagingSession messagingSession = DefaultMessagingSession.getInstance();
    Identifier topicIdentifier = messagingSession.createQueue("test-queue");
    Subscriber subscriber = messagingSession.subscribe("test-queue");
    while (true) {
    String message = (String)subscriber.getMessage();
    System.out.println(message);
    }

  • Subscription lost exception for message pattern

    We are using message pattern 2.4 and Coherence 3.5.3 patch 1.
    Seeing many subscription lost exception messages.
    I don't see any straight forward way to set the subscription expiration. We'd like to make it infinite (i.e. the getMessage() will block forever until
    a message has been put into the queue). Any suggest to get rid of this exception?
    Regards,
    Chen
    com.oracle.coherence.patterns.messaging.exceptions.SubscriptionLostException: Subscriber subscription was lost (with expired or the underlying destination has been removed)
         at com.oracle.coherence.patterns.messaging.AbstractSubscriber.ensureSubscription(AbstractSubscriber.java:282)
         at com.oracle.coherence.patterns.messaging.QueueSubscriber.getMessage(QueueSubscriber.java:81)
    com.oracle.coherence.patterns.messaging.exceptions.SubscriptionLostException: Subscriber subscription was lost (with expired or the underlying destination has been removed)
         at com.oracle.coherence.patterns.messaging.AbstractSubscriber.ensureSubscription(AbstractSubscriber.java:282)
         at com.oracle.coherence.patterns.messaging.QueueSubscriber.getMessage(QueueSubscriber.java:81)
    com.oracle.coherence.patterns.messaging.exceptions.SubscriptionLostException: Subscriber subscription was lost (with expired or the underlying destination has been removed)
         at com.oracle.coherence.patterns.messaging.AbstractSubscriber.ensureSubscription(AbstractSubscriber.java:282)
         at com.oracle.coherence.patterns.messaging.QueueSubscriber.getMessage(QueueSubscriber.java:81)

    Hi Wenjie,
    Try defining the <security-identity> in your ejb-jar.xml as the following:
    <security-identity>
         <description>SecurityIdentity</description>
         <use-caller-identity/>
    </security-identity>
    BTW, I suggest that you should use NW Developer Studio to edit your descriptors.
    Regards,
    Mustafa.

  • How C++ client uses coherence message message pattern to subscribe/publish

    Hi,
    I need to know how c++ client can subscribe/publish messages on queue or topic?
    I was able to find messaging jar and common jar for java but I was not able to find any sort of c++ implementation.
    I think this feature is definitely supported by c++ and .Net. If there's any shared library please let us know or please share the messaging protocol and mechanism which we need to do in order to acheive topic/queue messaging feature.
    regards,
    Sura

    Hi Mark,
    As I know, in invocation service client will be the invoker for relevant query. So during the invocation we can get relevant results. But assume that after invocation there's some pending updates arrived to relevant topic. In that case do we need to pull again. If we need to pulll then we need to write a deamon thread by asking him to pull relevant topic data.
    Thanks a lot for the info. Hope you will share some expertise.
    regards,
    sura

  • Feedback on use of incubator command pattern

    Hi,
    We are currently prototyping some different solutions using coherence incubator (namely command pattern) and are looking for some feedback as to the viability and potential improvements to the solution.
    h3. Summary of Prototype
    The prototype does the following (i have a nice sequence diagram for this but don't see a way to attach it :():
    + client (e.g. through coherence extend) calls local api to save a "message" for a particular account (e.g. Account id = 1234). This calls namedcache.put and inserts an entry into the cache.
    + BackingMapListener is configured for the cache into which the client indirectly inserts. In the prototype this is a spring bean that extends AbstractMultiplexingBackingMapListener - which is fully "loaded" with all the required dependencies for the processing of the message (services, etc.).
    + The listener then registers a new context (using ContextManager) using a "grouping" id based on the sequence/ordering requirements. For example, say that each message against an account needs to be processed in order. The context would get instantiated with name = "1234", so that subsequent requests for account 1234 will get queued against the context with the same name whilst the previous request(s) are still processing. Messages for other accounts would register a different context name so they will get simultaneously processed.
    NB: The functionality of this listener can be paralleled to the sample in CommandPatternExample for one submission. I am not entirely clear where command submissions typically "tie-in" but I am planning to kick them off from a backingmaplistener. I briefly explored using the 'com.oracle.coherence.common.events.dispatching.listeners.DelegatingBackingMapListener' to dispatch the commands but not entirely how this would tie in. As I understand it the delegating backingmaplistener is used within the 'liveobjects' context and dispatches entries that implement the LifecycleAwareEntry but not sure how we would create "custom-contexts" as we require (i.e. the identifier is not for the key of the cache entry but rather a subset of that -e.g. account id versus account message id).
    + A command is then created to process the account message, which is comprised of
    - the Account which needs processed (the value of the backing map listener contains the Account itself)
    - Any components that are required during processing (services, daos, etc - service might itself be injected with daos, etc.)
    + The newly instantiated command is then then submitted to the CommandSubmitter for the appropriate contextIdentifer (the one returned by 1234 in our example).
    From some basic tests, the prototype is behaving as I desire - i.e. it queues and "synchronizes" the commands for the same context and also simultaneously processes commands assigned to different contexts asynchronously. That's great.
    However, there are a number of things I am exploring for the actual implementation. I believe most of these are typical concerns so I wonder if Oracle or anyone can provide some feedback from past experience/proposed recommendations:
    h3. Questions
    h4. 1. Grid/server-side Business Logic Deployment
    One of the things that has occurred to us is that ideally we would like to store the business processing logic (i.e. the heart of the processing within the command) either inside the grid or within a coherence node (i.e. made available through the classpath of the node startup).
    In our case we have a few different "processing models", but ideally the processor/command will simply determine the appropriate control flow (i.e. within the command - or maybe the appropriate lifecycle if we end up using that) and associated business logic off the attributes of the object to be processed. I am not sure if our use case is typical, but to be clear we have a fair bit of business logic to be performed within the 'command', each in separate modules. In implementation, most modules will be interacting with the grid for lookups, etc. but ideally that will be abstracted from the Processor/Command which will only know that it is using an 'accountService' - for e.g.
    Currently the business logic is "loaded" into the listener and "passed on" to the command through composition. Ideally we ant the command would be light-weight and the various "processing models" would either:
    a) be deployed to each node and somehow "available" to the command during execution. Would need to work out how this would be come available to the execution environment; perhaps each 'Context' would wrap the processing details. However, even this is a bit too granular as likely a processing model will apply to many contexts.
    b) Perhaps the business logic/processing components are deployed to the cache itself. Then within the command attributes on the object would be consulted to determine which processing model to "apply" and a simple lookup could return the appropriate control flow/processor(s).
    c) Perhpaps the different logic/flow is embedded in a different "lifecycle" for the event processing and the appropriate lifecycle is detected by the listener and appropirately applied. Even with such a model we'd still like the various processing for each phase to be maintained in the server if possible.
    Has anyone else done something like this and/or are there any thoughts about deploying the business logic to the grid this way? I see advantages/disadvantages with the different solutions, and some of them seem better for upgrades. For example if you upgrade the processing logic whilst requests are still coming in (clearly you would attempt to avoid this) and it is embedded into each node, what would happen if one node has been upgraded and a request comes to that node. Say one of the business logic modules performs a query against the cache which needs to consult another node (e.g. assuming you're using partitioned data) and that node has not received the upgrade and there's a conflict. In that regard perhaps deploying the different processing logic to a replicated cache makes more sense because once updated it should get pushed immediately to all nodes?
    Are these known concerns? I'm new to grid-side processing concepts so just correct me if there's an obvious issue with tis.
    h4. 2. Cleanup/Management of contexts
    One thing I noticed on my prototype is that the context's that I create don't really go away. We are envisioning creating Many context per day (let's just say a few hundred million to be safe)
    so ...
    a) how do people normally remove the contexts? Does the command framework sort this out behind the scenes? I can see the 'stop' method on the CommandExecutor removing the context, but from a quick follow-through the only scenario which seems to potentially call this is if the context version number has changed. Is there some way to change the version when we submit additional commands to the same context?
    b) Is there an issue with creating this many Contexts? As per earlier mention, to reduce overhead ideally the context will not be too heavy but any thoughts on our intended usage? We could use something like a hashing scheme to "bucket" the requests to contexts to reduce the total number of Contexts if required but this is not ideal.
    h4. 3. Creation of new Command Every time.
    In our scenario, each command needs to act upon a given object (e.g. one account). As I see it, this requires us to create a new Command for each message, because I do not see a way to 'pass in' the object to the execute method. Setting it to the context does not work either because we need to queue a few requests to each given context; I played with wrapping the object with GenericContext and setting the value but in reality we're submitting the commands whilst others are currently being processed so I don't see how this could work.
    Any thoughts on this? Do you agree we'll have to create a new command for every message to be processed? We'll likely have millions of Commands per day so this will make a difference for us (although if we eliminate the logic from q#1 or the dependencies are singletons it's not a big deal)
    h4. 4. Concurrency guarantees with the commandpattern
    I also want to confirm my understanding of concurrency controls around the command pattern. Unlike an entry processor which controls updates to the entry upon which it was invoked, the command pattern only guarantees concurrency against processing occuring within the context of the currently operating command. Commands submitted to the same context will be processed synchronously but any entries which may have had a listener which spawned the command submission are in no way guarded. This latter point is pretty obvious I believe since there's no real link but I just want to make sure my assumptions are correct.
    NB: in the scenario I am describing we do NOT need to update the original cache entry into which the account message was submitted. Instead other caches will be updated with results from additional processing logic so this is not that much of an issue for us.
    h4. 5. Confirmation of concerns with "straight" entry processor
    If we were to use a "straight" entry processor (versus command pattern which uses entry processor) which gets kicked off from a threadpool on a backing map listener (for example on insert or update), is it true that if a node were to go down, we would have issues with failover? NB: The reason we would kick off the entry processor from a threadpool would be to "simulate" asynchronous processing. As I see it, if we kicked off a thread on the listener and returned back to the client, nothing would "re-submit" the request if a node goes down. Is that correct?
    ALTERNATIVELY, As I understand it, with an entry processor invoked from a client, it is the client coherence jar that receives the exception when a node goes down mid-process and the coherence jar takes care of "re-sending" the request to another node. So - if the threadpool is managed by the client and the client kicks off an invoke in one of the threads - then I believe the client WILL re-submit the entry processor requests if the node goes down - through the coherence jar/extend - not sure on the details but my point is that the client application does not have to provide any code for the "failover" but the coherence client jar performs this.
    h4. 6. Lifecycle
    I have not explored the "lifecycle" functionality available within the incubator - but as I understand it the main thing it could offer is that if we have many phases of the processing (as we do in most our use cases) - that the processing can be managed with the different lifecycles. NB: To be clear I am referring to 'live objects' with their own series of processing steps - not 100% if Lifecycle directly relates to 'live objects'. If a node goes down and is in the midst of processing 200,000 commands - the entire processing doesn't need to start over.. each request will need to go back to the previous completed phase of the lifecycle but may well avoid duplicated processing. All processing will need to be idempotent regardless, but lifecycles could avoid re-processing that was already complete.
    Is this correct?
    Other benefits?
    (e.g. configurable processing logic as alluded to in Q#1).
    Thanks very much
    Edited by: 822486 on 21-Dec-2010 16:23
    Edited by: 822486 on 21-Dec-2010 16:59

    Hi User 822486,
    When delving into a detailed prototype like the one you have below it's often useful to understand the use cases and business requirements before jumping into a solution. I think it may be best for you to reach out to the Coherence organization within oracle to further discuss these questions in detail so we can better guide you in the different ways to solve problems with Coherence and the incubator. I'll do my best to comment on your prototype and address the questions that you currently have:
    NB: The functionality of this listener can be paralleled to the sample in CommandPatternExample for one submission. I am not entirely clear where command submissions typically "tie-in" but I am planning to kick them off from a backingmaplistener. I briefly explored using the 'com.oracle.coherence.common.events.dispatching.listeners.DelegatingBackingMapListener' to dispatch the commands but not entirely how this would tie in. As I understand it the delegating backingmaplistener is used within the 'liveobjects' context and dispatches entries that implement the LifecycleAwareEntry but not sure how we would create "custom-contexts" as we require (i.e. the identifier is not for the key of the cache entry but rather a subset of that -e.g. account id versus account message id).
    Command submissions are just that, submissions to the command pattern for execution and they can be triggered from anywhere since they run asynchronously. The DelegatingBackingMapListener and the associated eventing model provides you with the foundations for building an Event Driven Architecture on top of coherence. It's used by both the Push Replication Pattern as well as the Messaging Pattern which you could use as references if you wanted to go down the path of using the eventing model as well. It really comes down to your use case (which I don't have a lot of details on at the moment). An Entry that is a LifecycleAwareEntry can basically take action when it's state is changed (an event occurs). As a completely bogus example you could have a AccountMessageDispatcher object in a cache with a DelegatingBackingMapListener configured and you could submit EntryProcessors to this dispatcher that gives it a set of messages to perform for a set of accounts. The Dispatcher could then every time it's updated submit commands for execution. In essence it's formalizing an approach to responding to events on entries - or server side event driven programming.
    h2. Grid/server-side business logic deployment
    Have you looked at the processing pattern at all? It's a framework for building compute grids on top of Coherence and may have more plumbing in place for you to achieve what you're looking for. I think it may be best for us to discuss your use case in more detail to understand the pros and cons of each approach before commenting further on a solution for you.
    h2. Cleanup and Management of contexts
    Contexts are marker interfaces so they can be incredibly lightweight which should allow you to create as many of them as you need. The biggest concern is ensuring that you have enough processing power in your grid to handle the volume of work you want to manage. This should be a simple matter of figuring out your load and sizing your cluster appropriately. The initial design of the command pattern was to have a set of well established contexts that would be used repeatedly. Given that the Command Pattern is primarily an example, you could extend the DefaultContextsManager to have an unregisterContext method.
    h2. Creation of new command every time
    I'm a little confused by your requirement here. Are you saying that you have a set of pre-defined operations that you want to apply to an account for example incrementAccountBalancyBy1? If so, I don't understand why you couldn't submit the same command instance to a context multiple times. While I wouldn't recommend using statics you could have a CommandFactory that returned the same command each time you call getCommand once it was instantiated once. Usually however we expect that you'll have some additional data unique to each message that the command must execute. This could be handled by having a setter on your command for these properties.
    h2. Concurrency Guarantees
    The Command Pattern Guaranteees that for a given context commands are processed synchronously in the order they are received. If you have multiple submitters sending commands to the same context, then the order of when the commands are processed will be based on the order in which they arrive at the node where the Context resides. A context is the control point that gives commands their ordering.
    h2. Confirmation of concerns with "straight" entry processor
    I'm not sure if I follow your question here. EntryProcessors are guaranteed to execute, even in the failure scenario (this is why they're backed up and why they must be idempotent). If you're referring to processing events based on a backing map listener rather than submitting commands, it handles your processing then it's a matter of wether you're asynchronously processing the events or not. If you are synchronously processing things and your node dies while the BML is executing you're right a node failure at that point will result in "nothing happening" and the client will re-try. If however you're asynchronously handling the events from your BML, then you could lose state. This is why we use entries the way we do in the common event layer, we persist state on an entry that we can't lose when a node fails. This allows us to asynchronously process the data after the node has been updated.
    h2. Lifecycle
    With respect to lifecycle if you're referring to LifeCycleAwareEntry - this is a way of designating that an Entry in the cache can process events when modified/mutated. This may be better discussed by phone or in person.

  • Collect Messages using BPM

    Hi all,
            Am doing a collect message pattern using BPM. After collecting messages wen mapping is called its throwing exception. CAn you help me out in this. I ll explain.
    the input i give is :
    <Root>
           <Name> asd </name>
           <ID> A </ID>
    </Root>
    i sent thid message 5 times to BPM (using collect pattern).
    the stop message is of the format
    <Stop>
       <ID> A</ID>
    </Stop>
    wen i send this the collect block is exited and the flow comes  to a transformation step which does a n:1 mapping
    ie. in my mapping i add the source message type and changed its occurence to unbounded in messages Similarly in IM also i changed the occurence of source MI to unbounded. wen i test the message mapping with this
    <Root>
           <Name> asd </name>
           <ID> A </ID>
    </Root>
    as input it gives the exception. But if i gve like this ten its showing successful.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>
    <Root>
           <Name> asd </name>
           <ID> A </ID>
    </Root>
    </ns0:Message1>
    </ns0:Messages>
    But how can wedo that as transforamtion happens in BPM. PLease help me out in this

    Hi,
    Check these links
    /people/stefan.grube/blog/2006/09/18/collecting-idocs-without-using-bpm
    /people/pooja.pandey/blog/2005/07/27/idocs-multiple-types-collection-in-bpm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/76/5d373f5e550456e10000000a114084/frameset.htm
    Regards,
    Kumar

  • XI BPM Collect Meassages Scenario with one Message as an optional

    Hi guys,
    I need help to implement XI BPM Scenario with Collect Messages Pattern. Here is my Scenario. I am getting four different types of flat files from four interfaces. Using these four files I need to merge using correlation relation and finally have to create One IDoc type to send it to SAP R/3.
    But out of these four messages last Message type is an Optional Message. i.e the process has to continue even if forth message is not available by taking first three messages.
    Please let me know which pattern is suitable for this scenario.
    Thanks.
    Siva.

    Hi,
    I hope u are receiving four different interfaces.Have a local container variable of simple type integer.you put a fork with four branches after the start step.Each branch has a receive step corresponding to one interface. Then after each of the receive step in each branch put a container operation performing some action on the container variable may be incrementing.so in the end condition of the fork check the value of the container variable i.e you can check if that variable is 3(three of the interfaces have been got).so this ensures that ur fork doesnot wait for all the four.hope this works.
    Regards,
    Sudharshan

  • Payload size limit and message transmission failures.

    I am receiving data feed from external third party using one-way messaging pattern through 'Oracle Service Bus' ---->'Web Service' --> 'Mediator' ---> 'DBAdapter'. We are carrying out tests to verify the number of messages sent by third party which should matches with messages received by us.
    However, during a 48 hr test the number of messages received was close to 400000 messages. There is a mismatch of 60 messages which fail transmission at the senders end and strikingly all the 60 messages are larger size than the normal ones. They are upto 65KB to 78KB. I was wondering if SOA or OSB applies some default filter on size that causes the messages not to come through. Nomral ones are 2 to 11KB.
    Also, the payload of the messages contains lists, i.e. contains a simple data structure. I went through some Oracle SOA Suite documentation but could not find anything specific to relate to these message failures. Is there any filters active due to the default configuration of the product that I am not aware of.
    Please suggest.
    Thanks

    anything in the log? a stacktrace, something?

  • JMS message archives

    We are implementing our messaging services using JBoss JMS. The question here is specific to JMS in general.
    We are using durable PTP messaging pattern. The messages will be deleted from the JMS_MESSAGING table as soon as they consumed by the message consumer.
    But because of our business requirements we need to keep those messages in the table for certain period of time (couple months at least). Is it possible to keep them in the database using JMS? What are the steps I need to follow to achieve that?
    -APK.

    Use topics instead of queues. Add an extra subscriber that stores the message in a database.
    If you can't use topics for some reason then either...
    a. Write a message listener that reads the messages from the original queue, stores them in a database then forwards them on to a new queue. Reconfigure your original consumer to read messages from the new queue.
    b. Write a message listener that duplicates the messages from the original queue, and forwards them to two new queues. One queue will be read by the original consumer, the other by a message listener that stores the message in the database.
    Option b is more complex but has the slight advantage that if your database is temporarily down, but JMS is still working your consumer will keep getting messages.
    For any of these solutions you need to make sure you're using distributed transactions, so the JMS and JDBC part are atomic. If not you run the risk of either losing messages or more likely processing them twice.

  • Duplicate messages/database inserts despite XA

    I have a simple test application which reads a single message at a time from WebSphere MQ, calls a tux service to insert into a database and writes an output MQ message (again via a tux service). The app is duplicating database inserts and MQ puts despite it being configured to use XA.
    I am running with AUTOTRAN=Y and can see the XA transactions in the trace.
    If I cause a DB failure (oracle 11g -> dataguard with fast start failover) , the servers exit and are re-started (this appeared to be the best way of cleaning up) however I get duplicates, despite the XA trace implying the global transaction was rolled back:
    124530.tuxtestmachine!s_mq.1016002.1.0: gtrid x0 x4aec30de x8d3: ...MQ Read->GPU POC TEST MSG18313<0> <<<<<<MQGET here
    124530.tuxtestmachine!s_mq.1016002.1.0: gtrid x0 x4aec30de x8d3: ...................calling <getu>
    124530.tuxtestmachine!server.864336.1.0: gtrid x0 x4aec30de x8d3: getu started
    124530.tuxtestmachine!server.864336.1.0: gtrid x0 x4aec30de x8d3: ..Input<GPU POC TEST MSG18313>
    124530.tuxtestmachine!server.864336.1.0: gtrid x0 x4aec30de x8d3: Conver string
    124530.tuxtestmachine!server.864336.1.0: gtrid x0 x4aec30de x8d3: .............................getu<GPU POC TEST MSG18313->GPU POC TEST MSG18313>
    124530.tuxtestmachine!server.864336.1.0: gtrid x0 x4aec30de x8d3: getu complete
    124530.tuxtestmachine!s_mq.1016002.1.0: gtrid x0 x4aec30de x8d3: ..returned from getu
    124530.tuxtestmachine!s_mq.1016002.1.0: gtrid x0 x4aec30de x8d3: ..calling mqwrite
    124530.tuxtestmachine!s_mq.1016002.1.0: gtrid x0 x4aec30de x8d3: ...................calling <mqwrite>
    124530.tuxtestmachine!s_mqwrite.651446.1.0: gtrid x0 x4aec30de x8d3: TRACE:at: { tpservice({"writemq", 0x10, 0x20077930, 22, 0, -2147483648, {0, -2, -1}})
    124530.tuxtestmachine!s_mqwrite.651446.1.0: gtrid x0 x4aec30de x8d3: ...in mqwrite
    124530.tuxtestmachine!s_mqwrite.651446.1.0: gtrid x0 x4aec30de x8d3: +++++Writing to MQ<GPU POC TEST MSG18313><GPU POC TEST MSG18313> <<<This is the MQPUT
    124530.tuxtestmachine!s_mqwrite.651446.1.0: gtrid x0 x4aec30de x8d3: TRACE:at: { tpreturn(2, 0, 0x20077930, 0, 0x0)
    124530.tuxtestmachine!s_mq.1016002.1.0: gtrid x0 x4aec30de x8d3: ..insert to database
    124530.tuxtestmachine!s_mq.1016002.1.0: gtrid x0 x4aec30de x8d3: ..............Calling dbinsert with <GPU POC TEST MSG18313><21>
    124530.tuxtestmachine!s_mq.1016002.1.0: gtrid x0 x4aec30de x8d3: ...................calling <db_insert>
    124530.tuxtestmachine!s_ora.897234.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: { /ò!(0x20019b74, 0, 0x0)
    124530.tuxtestmachine!s_ora.897234.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: } /ò! = -7
    124530.tuxtestmachine!s_ora.897234.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: { xa_open(0x2002035c, 0, 0x0)
    124530.tuxtestmachine!s_ora.897234.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: } xa_open = 0
    124530.tuxtestmachine!s_ora.897234.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: { xa_start(0x20019b74, 0, 0x0)
    124530.tuxtestmachine!s_ora.897234.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: } xa_start = 0
    124530.tuxtestmachine!s_ora.897234.1.0: gtrid x0 x4aec30de x8d3: ...Calling dbinsert<GPU POC TEST MSG18313>
    124530.tuxtestmachine!s_ora.897234.1.0: gtrid x0 x4aec30de x8d3: Database failure : ORA-25408: can not safely replay call <<<<As a result of the DB failure
    124640.tuxtestmachine!MQXA.778310.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: { xa_rollback(0x200196b4, 0, 0x0)
    124640.tuxtestmachine!TMS_ORA.1085652.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: { xa_rollback(0x2001a454, 0, 0x0)
    124640.tuxtestmachine!s_mq.1016002.1.0: gtrid x0 x4aec30de x8d3: !!!Error calling<db_insert><13>
    124640.tuxtestmachine!MQXA.778310.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: } xa_rollback = 0 <<<< This looks to me like a succesful rollback by the TMS
    124640.tuxtestmachine!TMS_ORA.1085652.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: } xa_rollback = -7 <<Resource manage unavailable, DB is still unavailable here
    124640.tuxtestmachine!TMS_ORA.1085652.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: { xa_open(0x20020c3c, 0, 0)
    124640.tuxtestmachine!TMS_ORA.1085652.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: } xa_open = 0
    124640.tuxtestmachine!TMS_ORA.1085652.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: { xa_rollback(0x2001a454, 0, 0x0)
    124640.tuxtestmachine!TMS_ORA.1085652.1.0: gtrid x0 x4aec30de x8d3: TRACE:xa: } xa_rollback = 0
    $
    Anyone with any ideas as to where I go from here ? Your time is much appreciated.
    Thanks.

    Hi Dan,
    Thanks for the question.
    Currently the Messaging Pattern implementation does not use/implement JTA/XA or Coherence transactions. It's much like regular JMS in that it provides it's own transaction framework, that neither uses JTA or XA. While the JMS specification provides an XA API, the implementation of this is optional, as are Queues or Topics.
    The original goal of the Messaging Pattern implementation was to demonstrate that JMS-like messaging is possible with Coherence. When we looked at constructing the Messaging example, most people we talked to said they didn't want JMS and especially they didn't want transactions. They simply wanted a simple messaging implementation. So it's initial goal was to demonstrate a high-scalable messaging layer. Unfortunately that meant no "real" transaction support, especially in terms of things like XA and/or JTA.
    That said given the way that the pattern is currently implemented one could easily implement an XA resource so that it could be used as a last resource. That's probably the quickest way to get what you would like at the moment.
    Of course I'm certainly interested in implementing XA support, but we know that is non-trivial. It's not currently on our roadmap for the pattern, but it could be. Our next release will provide persistent messaging, but we could investigate XA after that.
    -- Brian
    Brian Oliver | Architect | Oracle Coherence Engineering
    Oracle Fusion Middleware

  • Data processing in multiple caches in the same node

    we are using a partitioned cache to load data ( multiple types of data) in multiple named caches. In one partition, we plan to have all related data and we have got this using key association.
    Now I want to do processing with in that node and do some reconciliation of the data from various sources. We tried entry processor, but we want to consolidate all data from multiple named caches in the node. In a very naive form, I am thinking each named cache as a table and i am looking at ways to have a processor that will do some some processing on the related data.
    I see we could use a combination of Invocable object, Invocation service and entry processors, but I am unable to implement it successfully.
    Can you please point me to any reference implementation where I can do processing at the data node without transfering data back to client.
    Also any reference implementation of Map reduce (at the server side) in coherence would be helpful.
    Regards
    Ganesan

    Hi Ganesan
    A common approach to perform processing in the grid is to execute background threads in response to backing map listener events. The processing is co-located with data because the listener will be called in the JVM that owns the data. The thread can then make Coherence calls to access caches just like any other Coherence client.
    The Coherence Incbutor has numerous examples of this at http://coherence.oracle.com/display/INCUBATOR/Home. The Incubator Common component includes an event processing package that simplifies the handling of events. See the messaging pattern for an example: Message.java and MessageEventManager.java
    I am not sure I answered your question but I hope the information helps.
    Paul

  • Unable to Create Requestor ABCS using AIA Constructor in Jdev 11.1.1.2

    Hi Gurus,
    I'm currently trying to create ABCS Requester with J developer 11.1.1.2 using the AIA Service Constructor.
    The Composite Application shows the BPEL Component and the target services under the Composite screen.When we click on the BPEL Component we dont the process flow.
    Steps Followed
    1. Create project in Project Lifecycle Workbench
    2.Using the AIA Service Constructor connect to the AIA_LIFECYCLE Workbench.
    3.Select the RequestorABCS Service
    4.Filled out all the ApplicationName,ShortName,Service Version etc on Step 3 of 8
    5. Selected the Service Operation as Query.
    6.Under ABM import the Custom XSD structure and provided the Input and output message
    7.Select the message pattern as request/response
    8.Target Service Step selected the Query Service (this would query the required Customer Content which needs to be mapped).
    9.The the AIA Service Constructor creates BPEL Composite Component.
    When we double and open the BPEL Component we just see the error handling and partner link information.
    We are unable see any assign,scope invoke component on the swim lanes..
    Has anyone experienced this issue while creating ABCS Requester.
    Regards
    Sabir

    Hi Everyone,
    I was able to create Requestor ABCS in Jdev 11.1.1.2 by selecting EBS,wsdl as target. This is workaround you need to follow to create requestor ABCS where you have V2 wsdl available.
    Looks like there is bug#9541128 assigned for this issue. And looks like it would be fixed in 11.1.1.4 version of Jdev as per Oracle Support.
    Regards
    Sabir

  • Memory leak in CQC?

    We encountered a memory issue while using CQC. Using Coherence 3.5.3 patch 1.
    We are using the MapLister constructor approach for CQC.
    ContinuousQueryCache cqc = new ContinuousQueryCache(nameCache, filter, maplistener);
    Most of time it work fine.
    The NamedCache the CQC based on has an eviction policy of 2 hours.
    An extend client will insert entry into the NamedCache constantly.
    The CQC is created by a storage disable client and process the entry after received
    the map event. The same client will remove the entry from the NamedCache directly after
    finish processing the data.
    Sometime the client can't keep up the speed for processsing the data thus a backlog will
    build up in the NamedCache/CQC. In some extreme case, the data stored in the NamedCache
    will get evicted (by the 2 hours eviction policy) before the storage disable client has
    chance to process it. Which is fine since our code handle the case already.
    However, we found out that the CQC seems to have some memory link when this occured.
    We did a heapdump and found out the the internal ObservableHashMap used by the CQC holding
    some MapEntry which already processed by the storage disable client (i.e. the map event
    already been processed) and also not existed in the underline NamedCache anymore (most
    likely remvoed by the eviction policy). This caused OOM eventually.
    Any suggestion about this? I don't see any "sync" operation on the CQC. Destroy the CQC
    and recreate it is not an option for us.
    I don't see any related bug fixes from patch 2 to patch 6 either.
    Regards,
    Chen

    More update.
    When this problem occured, we also hit a possible message pattern bug (2.4). Which we can see one of the storage node generate a NullPointException every
    seconds while try to process a CommandExecutionRequest.
    Now my question is that will the evication policy on that node will somehow failed to evict data or failed to send out a delete map listener event to the CQC?
    Do eviction policy and the map event delievery guarantee to happen?
    Regards,
    Chen

  • - How do you refer to an HTML carriage return in PHP?

    Someone sent me a php script that replaces foul language with
    kinder words
    in message board postings. I'd like the same script to weed
    out carriage
    returns, but we can't find the correct syntax for it.
    We're using :
    $patterns[0] = '/\n\r/';
    What's the correct syntax to use in this situation?
    Thanks!

    "David Powers" <[email protected]> wrote in message
    news:[email protected]...
    > Reese wrote:
    >> "David Powers" <[email protected]> wrote in
    message
    >>>
    >>>$patterns[0] = '/[\n\r]/';
    >>>
    >>>That searches for either a newline character or a
    carriage return.
    >>
    >> I'm told this will only work in Windows. That Macs
    would require a
    >> different string. Two, even.
    >>
    >> Anyone know if this is true?
    >
    > What you have been told is only partly correct. Windows
    uses a carriage
    > return followed by a newline character (\r\n). Macs just
    use a newline
    > character (\n).
    >
    > The pattern I have given you search for either a newline
    character or
    > carriage return. So if it's applied in such a way as to
    remove all
    > instances, it will work on both Windows and Mac. An
    alternative pattern
    > which would also work on both is this:
    >
    > $patterns[0] = '/\r?\n/';
    >
    > It looks for an optional carriage return followed by a
    newline character.
    > In other words, it still matches if there isn't a
    carriage return.
    The response of my know-it-all roumanian programmer with an
    ego the size of
    Texas to that was :
    http://www.regular-expressions.info/characters.html
    (bottom of the page)
    \r\n = windows
    \n = Linux (not Mac)
    \r = Mac
    http://www.regular-expressions.info/optional.html
    (tells you what the '?'
    does)
    (it means that the character before it can be there 0 or 1
    times)
    \r?\n = \n (Linux) or \r\n (windows)
    It leaves out the \r all alone, like added by the Mac.
    So, it will not delete the Mac new lines (might delete the
    Mac OSX ones
    since that one is passed on Linux, but not the older ones.)
    Now, you can contradict me all you want and have a busted
    code (then you
    will say it doesn't work because I made it wrong), or do it
    like I told you
    and get it working like it should.
    To this, I told him I would present this to you for a
    rebuttal, but not
    before asking him why he used only the '/\r?\n/' model as an
    example, and
    not the recommended '/[\n\r]/'. Something tells me he has no
    idea what [
    and ] do in this context, so he's avoiding it altogether --
    even though it
    may very well solve the problem on its own the way you claim
    it does.

Maybe you are looking for