Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Register
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
System
Register
Commits
71b9929e
Commit
71b9929e
authored
3 years ago
by
Nikhil Singh[MicroSoft]
Browse files
Options
Downloads
Patches
Plain Diff
Commit 9 Contents:
1-Handle NPE for Management Client
parent
c8ac2195
No related branches found
No related tags found
2 merge requests
!102
Locking down maven central
,
!97
Service Bus Create and Delete Support for Subscriptions
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/subscriber/pubsub/PullSubscription.java
+17
-3
17 additions, 3 deletions
...er/provider/azure/subscriber/pubsub/PullSubscription.java
with
17 additions
and
3 deletions
provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/subscriber/pubsub/PullSubscription.java
+
17
−
3
View file @
71b9929e
...
...
@@ -15,6 +15,7 @@
package
org.opengroup.osdu.register.provider.azure.subscriber.pubsub
;
import
com.microsoft.azure.CloudException
;
import
com.microsoft.azure.servicebus.management.ManagementClient
;
import
org.opengroup.osdu.azure.partition.PartitionServiceClient
;
import
org.opengroup.osdu.core.common.logging.JaxRsDpsLog
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
...
...
@@ -30,6 +31,7 @@ import org.springframework.stereotype.Component;
public
class
PullSubscription
implements
IPubsubSubscription
{
// TODO: UPDATE ERROR_MESSAGE FOR SERVICE BUS
private
static
final
String
RESOURCE_PROVISIONING_ERROR_MESSAGE
=
"Resource cannot be updated during provisioning"
;
private
static
final
String
MANAGEMENT_CLIENT_ERROR_MESSAGE
=
"Unable to create management client"
;
@Autowired
private
IManagementClientFactory
factory
;
@Autowired
...
...
@@ -43,7 +45,11 @@ public class PullSubscription implements IPubsubSubscription {
public
void
createSubscription
(
String
subscriptionId
,
String
topicAliasName
)
{
try
{
factory
.
getManager
().
createSubscription
(
topicAliasName
,
subscriptionId
);
ManagementClient
managementClient
=
factory
.
getManager
();
if
(
managementClient
==
null
)
{
throw
new
AppException
(
500
,
"Null Pointer Exception"
,
MANAGEMENT_CLIENT_ERROR_MESSAGE
);
}
managementClient
.
createSubscription
(
topicAliasName
,
subscriptionId
);
}
catch
(
Exception
e
)
{
if
(
e
.
getMessage
().
equals
(
RESOURCE_PROVISIONING_ERROR_MESSAGE
))
{
logger
.
error
(
"Another request is trying to create the same Pull subscription"
);
...
...
@@ -57,7 +63,11 @@ public class PullSubscription implements IPubsubSubscription {
public
void
deleteSubscription
(
String
subscriptionId
,
String
topicAliasName
)
{
try
{
factory
.
getManager
().
deleteSubscription
(
topicAliasName
,
subscriptionId
);
ManagementClient
managementClient
=
factory
.
getManager
();
if
(
managementClient
==
null
)
{
throw
new
AppException
(
500
,
"Null Pointer Exception"
,
MANAGEMENT_CLIENT_ERROR_MESSAGE
);
}
managementClient
.
deleteSubscription
(
topicAliasName
,
subscriptionId
);
}
catch
(
Exception
e
)
{
if
(
e
instanceof
CloudException
)
{
CloudException
cloudException
=
(
CloudException
)
e
;
...
...
@@ -72,7 +82,11 @@ public class PullSubscription implements IPubsubSubscription {
public
void
checkIfSubscriptionExists
(
String
subscriptionId
,
String
topicAliasName
)
{
try
{
factory
.
getManager
().
getSubscription
(
topicAliasName
,
subscriptionId
);
ManagementClient
managementClient
=
factory
.
getManager
();
if
(
managementClient
==
null
)
{
throw
new
AppException
(
500
,
"Null Pointer Exception"
,
MANAGEMENT_CLIENT_ERROR_MESSAGE
);
}
managementClient
.
getSubscription
(
topicAliasName
,
subscriptionId
);
}
catch
(
Exception
e
)
{
if
(
e
instanceof
NullPointerException
)
{
logger
.
error
(
String
.
format
(
"Pull Subscription with id %s does not exist."
,
subscriptionId
));
...
...
This diff is collapsed.
Click to expand it.
Morris Estepa
@estepamo
mentioned in commit
9b6eaa9c
·
2 years ago
mentioned in commit
9b6eaa9c
mentioned in commit 9b6eaa9cabc1af6538b17b6f76382473f6467c69
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment