forked from RestComm/jain-slee.diameter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for issue RestComm#9 - failover & load balancing
- Loading branch information
Grzegorz Figiel
committed
Jan 16, 2017
1 parent
5d6dacf
commit 82f6766
Showing
18 changed files
with
537 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,47 @@ | ||
# Java compiled # | ||
################# | ||
######## Java compiled ######### | ||
################################ | ||
*.class | ||
|
||
# Eclipse # | ||
########### | ||
########### Eclipse ############ | ||
################################ | ||
.classpath | ||
.project | ||
.settings | ||
|
||
# IntelliJ IDEA # | ||
################# | ||
.idea/ | ||
######## IntelliJ IDEA ######### | ||
################################ | ||
.idea | ||
*.iml | ||
*.iws | ||
|
||
# Maven # | ||
######### | ||
########## NetBeans ############ | ||
################################ | ||
nbactions.xml | ||
|
||
# Mobile Tools for Java (J2ME) # | ||
################################ | ||
.mtj.tmp | ||
|
||
############ Maven ############# | ||
################################ | ||
target | ||
*.jar | ||
*.war | ||
*.ear | ||
|
||
# OS generated files # | ||
###################### | ||
###### OS generated files ###### | ||
################################ | ||
.directory | ||
.Trashes | ||
._* | ||
*~ | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
Icon? | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
######## VM crash logs ######### | ||
################################ | ||
hs_err_pid* |
63 changes: 63 additions & 0 deletions
63
...mon/events/src/main/java/net/java/slee/resource/diameter/base/events/DeliveryFailure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package net.java.slee.resource.diameter.base.events; | ||
|
||
import net.java.slee.resource.diameter.base.events.avp.DiameterIdentity; | ||
|
||
import org.jdiameter.api.Message; | ||
import org.jdiameter.api.RouteException; | ||
|
||
/** | ||
* Event that represents delivery failure of a given message. | ||
*/ | ||
public interface DeliveryFailure { | ||
|
||
/** | ||
* Returns an exception that made delivery of a given message impossible. | ||
* | ||
* @return exception | ||
*/ | ||
RouteException getCause(); | ||
|
||
/** | ||
* Returns the request that caused Tx timeout to expire due to no response from a remote peer. | ||
* | ||
* @return origin request | ||
*/ | ||
Message getRequest(); | ||
|
||
/** | ||
* Returns the name of the last selected remote peer that a given message has been routed to. | ||
* | ||
* @return peer name | ||
*/ | ||
DiameterIdentity getLastPeer(); | ||
|
||
/** | ||
* Returns true if last selected remote peer is present for a given message. | ||
* | ||
* @return true if peer name is present | ||
*/ | ||
boolean hasLastPeer(); | ||
|
||
} |
98 changes: 98 additions & 0 deletions
98
...s/src/main/java/org/mobicents/slee/resource/diameter/base/events/DeliveryFailureImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package org.mobicents.slee.resource.diameter.base.events; | ||
|
||
import net.java.slee.resource.diameter.base.events.DeliveryFailure; | ||
import net.java.slee.resource.diameter.base.events.avp.DiameterIdentity; | ||
|
||
import org.jdiameter.api.Message; | ||
import org.jdiameter.api.RouteException; | ||
|
||
/** | ||
* Delivery failure implementation. | ||
*/ | ||
public class DeliveryFailureImpl implements DeliveryFailure { | ||
|
||
protected RouteException cause = null; | ||
protected Message request = null; | ||
protected DiameterIdentity peer = null; | ||
|
||
/** | ||
* Constructor. | ||
* @param request | ||
* @param peer | ||
*/ | ||
public DeliveryFailureImpl(RouteException cause, Message request, DiameterIdentity peer) { | ||
this.cause = cause; | ||
this.request = request; | ||
this.peer = peer; | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see net.java.slee.resource.diameter.base.events.DeliveryFailure#getCause() | ||
*/ | ||
public RouteException getCause() { | ||
return cause; | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see net.java.slee.resource.diameter.base.events.DeliveryFailure#getRequest() | ||
*/ | ||
public Message getRequest() { | ||
return request; | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see nnet.java.slee.resource.diameter.base.events.DeliveryFailure#getLastPeer() | ||
*/ | ||
public DiameterIdentity getLastPeer() { | ||
return peer; | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see net.java.slee.resource.diameter.base.events.DeliveryFailure#hasLastPeer() | ||
*/ | ||
public boolean hasLastPeer() { | ||
return peer != null; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("\r\n"); | ||
sb.append("+--------------------------- Delivery failure ---------------------------------+\r\n"); | ||
sb.append("| Last selected peer: ").append(peer).append("\r\n"); | ||
sb.append("| Failure for message: ").append(request).append("\r\n"); | ||
sb.append("| Application-Id..........").append(request.getApplicationId()).append("\r\n"); | ||
sb.append("| Hop-By-Hop Identifier...").append(request.getHopByHopIdentifier()).append("\r\n"); | ||
sb.append("| End-To-End Identifier...").append(request.getEndToEndIdentifier()).append("\r\n"); | ||
sb.append("| Session-Id..............").append(request.getSessionId()).append("\r\n"); | ||
sb.append("| Root cause: ").append(cause).append("\r\n"); | ||
sb.append("+-----------------------------------------------------------------------------+\r\n"); | ||
return sb.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...mon/events/src/main/java/net/java/slee/resource/diameter/cca/events/RequestTxTimeout.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package net.java.slee.resource.diameter.cca.events; | ||
|
||
import net.java.slee.resource.diameter.base.events.avp.DiameterIdentity; | ||
|
||
import org.jdiameter.api.Message; | ||
|
||
/** | ||
* Tx timer as specified in RFC 4006: | ||
* | ||
* <pre> | ||
* 13. Credit-Control Application Related Parameters | ||
* | ||
* Tx timer | ||
* | ||
* When real-time credit-control is required, the credit-control | ||
* client contacts the credit-control server before and while the | ||
* service is provided to an end user. Due to the real-time nature | ||
* of the application, the communication delays SHOULD be minimized; | ||
* e.g., to avoid an overly long service setup time experienced by | ||
* the end user. The Tx timer is introduced to control the waiting | ||
* time in the client in the Pending state. When the Tx timer | ||
* elapses, the credit-control client takes an action to the end user | ||
* according to the value of the Credit-Control-Failure-Handling AVP | ||
* or Direct-Debiting-Failure-Handling AVP. The recommended value is | ||
* 10 seconds. | ||
* </pre> | ||
*/ | ||
public interface RequestTxTimeout { | ||
|
||
/** | ||
* Returns the request that caused Tx timeout to expire due to no response from a remote peer. | ||
* | ||
* @return origin request | ||
*/ | ||
Message getRequest(); | ||
|
||
/** | ||
* Returns the name of the last selected remote peer that a given message has been routed to. | ||
* | ||
* @return peer name | ||
*/ | ||
DiameterIdentity getLastPeer(); | ||
|
||
/** | ||
* Returns true if last selected remote peer is present for a given message. | ||
* | ||
* @return true if peer name is present | ||
*/ | ||
boolean hasLastPeer(); | ||
|
||
} |
Oops, something went wrong.