Hi Tim, Don't be sorry! Thank you so much for your help, that worked a treat!
Is there a way that I can set the base consumer priority in the xml config? So that messages prefer to travel through certain brokers? Thanks again, big help. ________________________________ From: Tim Bain <tb...@alumni.duke.edu> Sent: 03 November 2021 11:40 To: ActiveMQ Users <users@activemq.apache.org> Subject: Re: Network of brokers and priority network links Use static:(failover:(stuff))?maxReconnectAttempts=0. Sorry for not remembering that it needed to be wrapped in static:(), the masterslave transport has mostly eliminated direct use of the failover transport in NoB configuration, so my memory is rusty. Tim On Tue, Nov 2, 2021, 6:58 AM Paul Burgess <pburg...@peersoftware.com> wrote: > Hi Tim, > > Thank for the additional info. I actually use the failover transport > regularly for clients, so am aware of the priorityBackup option - thanks > all the same. > > To be honest, I'm not surprised about the failover transport being > unavailable, it's not listed anywhere in the network of brokers > documentation. As I understand it, network connectors and transport > connectors are treated very differently. Also, it's something that I have > tried in the past in a desperate attempt to get this going. Below is a log > snippet of the exception, confirming that the DiscoveryAgent is not > recognised. > > > WARN | Exception encountered during context initialization - cancelling > refresh attempt: org.springframework.beans.factory.BeanCreationException: > Error creating bean with name > 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path > resource [activemq.xml]: Cannot create inner bean > 'networkConnector#6ee660fb' of type > [org.apache.activemq.network.DiscoveryNetworkConnector] while setting bean > property 'networkConnectors' with key [0]; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating > bean with name 'networkConnector#6ee660fb' defined in class path resource > [activemq.xml]: Error setting property values; nested exception is > org.springframework.beans.PropertyBatchUpdateException; nested > PropertyAccessExceptions (1) are: > PropertyAccessException 1: > org.springframework.beans.MethodInvocationException: Property 'uri' threw > exception; nested exception is java.io.IOException: DiscoveryAgent scheme > NOT recognized: [failover] > ERROR | Failed to load: class path resource [activemq.xml], reason: Error > creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' > defined in class path resource [activemq.xml]: Cannot create inner bean > 'networkConnector#6ee660fb' of type > [org.apache.activemq.network.DiscoveryNetworkConnector] while setting bean > property 'networkConnectors' with key [0]; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating > bean with name 'networkConnector#6ee660fb' defined in class path resource > [activemq.xml]: Error setting property values; nested exception is > org.springframework.beans.PropertyBatchUpdateException; nested > PropertyAccessExceptions (1) are: > PropertyAccessException 1: > org.springframework.beans.MethodInvocationException: Property 'uri' threw > exception; nested exception is java.io.IOException: DiscoveryAgent scheme > NOT recognized: [failover] > org.springframework.beans.factory.BeanCreationException: Error creating > bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in > class path resource [activemq.xml]: Cannot create inner bean > 'networkConnector#6ee660fb' of type > [org.apache.activemq.network.DiscoveryNetworkConnector] while setting bean > property 'networkConnectors' with key [0]; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating > bean with name 'networkConnector#6ee660fb' defined in class path resource > [activemq.xml]: Error setting property values; nested exception is > org.springframework.beans.PropertyBatchUpdateException; nested > PropertyAccessExceptions (1) are: > PropertyAccessException 1: > org.springframework.beans.MethodInvocationException: Property 'uri' threw > exception; nested exception is java.io.IOException: DiscoveryAgent scheme > NOT recognized: [failover] > > > As said before, all help is very much appreciated. > > > ________________________________ > From: Tim Bain <tb...@alumni.duke.edu> > Sent: 02 November 2021 11:55 > To: ActiveMQ Users <users@activemq.apache.org> > Subject: Re: Network of brokers and priority network links > > For the second option, I think you'll also want to set the priorityBackup > option (see the Priority Backup section of > https://activemq.apache.org/failover-transport-reference.html) to get the > behavior of failing back to the fast link when it becomes available once > again. > > I'm very surprised to hear that the masterslave transport is available but > the failover transport is not. Can you provide the error message? > > Tim > > On Tue, Nov 2, 2021, 4:56 AM Paul Burgess <pburg...@peersoftware.com> > wrote: > > > Hi Gary, > > > > Thank you for the reply, both solutions would be perfect for what I need. > > > > With the first suggestion, I am unaware how to set the consumer base > > priority. I'm not running an integrated broker, standalone where all my > > configurations are withing the activemq.xml. I do apologise if I'm > missing > > something obvious. If this is something that can be done it would > > definitely be useful to me. > > > > As for the second suggestion, I would love for the failover transport to > > be available on network connectors, but it isn't. The closest thing is > the > > masterslave transport, which does not have fail-back (priority URI) > > capabilities. If you try to use the failover transport (discovery agent) > > then an exception will be thrown. > > > > Thanks again for the help, it's very much appreciated. > > > > > > ________________________________ > > From: Gary Tully <gary.tu...@gmail.com> > > Sent: 02 November 2021 10:04 > > To: users@activemq.apache.org <users@activemq.apache.org> > > Subject: Re: Network of brokers and priority network links > > > > there is one tweak with > > > > > org.apache.activemq.network.NetworkBridgeConfiguration#setConsumerPriorityBase > > which could be used to bias the fast links, set that to -1 for the > > fast links and the others will default to -5, so even with more > > brokers the fast links will have "higher" priority. > > > > the other option is to use a single bridge with two urls > > failover:(fast-link,slow-link)?randomize=false and the slow link will > > only be used on failure of the fast link. > > > > hope this helps! > > > > On Mon, 1 Nov 2021 at 16:57, Paul Burgess <pburg...@peersoftware.com> > > wrote: > > > > > > Hi JB, > > > > > > Thanks for the reply but no. I do use that option but in fact, if I > used > > this in this scenario it would have the opposite effect as the super-fast > > links go through more brokers than the slow one. > > > > > > To simplify the problem, just imagine 2 brokers connected to each other > > over 2 network links, one fast (primary) and the other slow > > (backup/failover). I only want to use the failover link when the primary > is > > in a failed state, meaning that I want to go back to the fast link on > > recovery. > > > > > > I feel like I have looked at every option but just want to confirm > > whether this can be done. > > > > > > Thanks again > > > > > > ________________________________ > > > From: Jean-Baptiste Onofre <j...@nanthrax.net> > > > Sent: 01 November 2021 16:46 > > > To: users@activemq.apache.org <users@activemq.apache.org> > > > Subject: Re: Network of brokers and priority network links > > > > > > Hi Paul, > > > > > > If you are using ActiveMQ 5.x, you can decrease network priority to > > allow local consumers first and fallback to remote brokers else. > > > > > > Is it what you are looking for ? > > > > > > Regards > > > JB > > > > > > > Le 1 nov. 2021 à 17:37, Paul Burgess <pburg...@peersoftware.com> a > > écrit : > > > > > > > > Hi, > > > > > > > > I'm trying to configure a network of brokers, where links between the > > brokers work as a 'Primary' and 'Secondary/Failover' pair, much like > > failover transport connections and priority URIs. > > > > > > > > I have links between sites that are fast and stable, that I want to > be > > used as a priority, with a backup link to be used only when there is a > > failure. After a failure, when the primary link becomes active, I need > > traffic to fail-back to that primary link. > > > > > > > > Is there a way I can achieve this? I have tried using the masterslave > > feature (although I know it's not really designed for this > functionality), > > which works under failure, but does not fail-back to the primary link. > > > > > > > > I have read somewhere about setting consumer priorities for a > specific > > broker, which I think would work, but I can't see anywhere how to set > this > > in configuration files. > > > > > > > > Maybe I missed something in the documentation? Perhaps there's a way > > to set a desire route? Any help is greatly appreciated. > > > > > > > > Many thanks > > > > > > > > Paul > > > > > >