Skip to content

Commit 34d7f80

Browse files
vishnu-alapatiVishnu
andauthored
Incorrect errormessage when publishing with a domainId larger than 255 chars (#246)
* Added proper error message when domainId is long Co-authored-by: Vishnu <vishnu.alapati@ericsson.com>
1 parent 078e1e5 commit 34d7f80

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## 2.0.25
22
- Implemented "publisher confirms " in REMReM so that this can be used to get confirmation about the messages sent to MB.
33
- Implemented configurable parameters for TCP connection timeout against LDAP and MB
4+
- Implemented changes to return proper error messages when DomainId value is greater than 255 chars.
45

56
## 2.0.24
67
- Updated all the curl commands in documentation

publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/helper/RMQHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private void protocolInit(String protocol) throws RemRemPublishException {
8989
rabbitmqProtocolProperties.init();
9090
}
9191

92-
public void send(String routingKey, String msg, MsgService msgService) throws IOException, NackException, TimeoutException, RemRemPublishException {
92+
public void send(String routingKey, String msg, MsgService msgService) throws IOException, NackException, TimeoutException, RemRemPublishException, IllegalArgumentException {
9393
String protocol = msgService.getServiceName();
9494
RabbitMqProperties rabbitmqProtocolProperties = rabbitMqPropertiesMap.get(protocol);
9595
if (rabbitmqProtocolProperties != null) {

publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/helper/RabbitMqProperties.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ private boolean hasExchange() throws RemRemPublishException {
447447
* @throws RemRemPublishException
448448
*/
449449
public void send(String routingKey, String msg)
450-
throws IOException, NackException, TimeoutException, RemRemPublishException {
450+
throws IOException, NackException, TimeoutException, RemRemPublishException, IllegalArgumentException {
451451
Channel channel = giveMeRandomChannel();
452452
channel.addShutdownListener(new ShutdownListener() {
453453
public void shutdownCompleted(ShutdownSignalException cause) {
@@ -481,6 +481,9 @@ public void shutdownCompleted(ShutdownSignalException cause) {
481481
} catch (TimeoutException e) {
482482
log.error("Failed to publish message due to " + e.getMessage());
483483
throw new TimeoutException("Timeout waiting for ACK " + e.getMessage());
484+
} catch (IllegalArgumentException e) {
485+
log.error("Failed to publish message due to " + e.getMessage());
486+
throw new IllegalArgumentException("DomainId limit exceeded " + e.getMessage());
484487
} catch (Exception e) {
485488
log.error(e.getMessage(), e);
486489
if(!channel.isOpen()&& rabbitConnection.isOpen()){

publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/service/MessageServiceRMQImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ public SendResult send(Map<String, String> routingKeyMap, Map<String, String> ms
8585
} catch (RemRemPublishException e) {
8686
event = new PublishResultItem(entryKey, HttpStatus.INTERNAL_SERVER_ERROR.value(), PropertiesConfig.SERVER_DOWN,
8787
e.getMessage());
88-
} catch (IOException e) {
88+
} catch (IllegalArgumentException e) {
89+
event = new PublishResultItem(entryKey, HttpStatus.BAD_REQUEST.value(), PropertiesConfig.INVALID_MESSAGE,
90+
e.getMessage());
91+
}catch (IOException e) {
8992
event = new PublishResultItem(entryKey, HttpStatus.INTERNAL_SERVER_ERROR.value(), PropertiesConfig.SERVER_DOWN,
9093
PropertiesConfig.SERVER_DOWN_MESSAGE);
9194
}

0 commit comments

Comments
 (0)