Label not available in Azure.Messaging.ServiceBus.ServiceBus.ServiceBusMessage - c#

I am migrating to Azure.Messaging.ServiceBus and have noticed that there is now no longer a property called Label
This is a huge problem as Label is used in our service bus rules to filter messages on a subscription.
What is the equivalant of setting message using the Azure.Messaging.ServiceBus and ServiceBusMessage
If I have to use Subject thats really bad because I would have to change every single rule in our service bus which is a total nightmare
Cheers
Paul

What is the equivalant of setting message using the Azure.Messaging.ServiceBus and ServiceBusMessage
That'd be the Subject property.
If I have to use Subject thats really bad because I would have to change every single rule in our service bus which is a total nightmare
You don't need to change anything on the broker side. The SDK (Azure.Messaging.ServiceBus) is a client-side SDK. Subject will be converted to Label and you don't need to modify the existing subscriptions rules. See documentation here.

Related

How to set Mandatory flag on RabbitMQ message

The RabbitMQ documentation make reference to a mandatory flag that can be set on a message that will cause the broker to respond with a BasicReturn instead of a BasicAck if a message cannot be routed to an Exchange.
However, I cannot find any example of how to actually set that flag when publishing a message. How would I go about setting that on a message?
If I had to discover this answer myself, I would first start by searching the code for the library using the keyword mandatory:
https://github.com/rabbitmq/rabbitmq-dotnet-client/search?q=mandatory
That leads to the correct answer pretty quickly:
Use the mandatory boolean argument to BasicPublish
Other potential searches and resource links:
Google Search
RabbitMQ .NET API Reference Docs
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

How to create real time order book since Poloniex exchange WAMP Api sequence number is not correlating with the sequence number got from the REST Api?

I am using C# WAMP client to connect to the Poloniex exchange to get the real time Market data.AS per the documentation provided by the exchange in order to create a real time order book we have to first get the snapshot of the order book through REST api provided by them and extract the sequence number from it and then connect to the WAMP server to get the streaming data and update the order book snapshot.
I have problem in updating the snapshot order book received through rest api since the sequence number which I received through the REST api is nearly 400k record ahead of the sequence number received through WAMP.
Is there any other way which I could get the real time Streaming data from the POloniex exchange or am I missing anything?
I have the same problem. Seems they have some bug. What I have noticed is that there are different sequences sent in normal update messages and in "heartbeat" messages (the ones without payload). The documentation states that a heartbeat message should repeat the last normal message sequence number. But it differs. However it corresponds to a number returned by REST API. So seems that "works" for heartbeat messages and wrong for normal ones. Looks pretty much as a bug.
Here is also some related question.
UPD: Also checked "newTrade" events with trade history returned by the REST API. Trade IDs in WAMP are significantly lower than actual ones in a snapshot. Seems the events published via push API are outdated by several hours and that is the explanation of all this behaviour. So the push API is unusable now.
And finally, seems that current way to go is using their pure WebSocket API which is used by web-interface. It is located at wss://api2.poloniex.com. The only problem is lack of documentation. One way is reverse engineering the traffic of the web-interface. Some poor pieces of information although can be found in code snippets like this or in discussion here.
The original websocket does not seem to be active. The one that is active is indeed: wss://api2.poloniex.com. I am coding my app in swift but maybe you will find this helpful. For orderbook entries I send the following message: "{"command":"subscribe","channel":"(coinPair)"}".
It is very important to use the quotes correctly (as above). The "(coinPair)" is string interpolation so you can include whatever coin pair you want to get the orderbook for. Of course you have to eliminate the (). These are for swift only.
If you want to get a live feed of the prices of all of the tickers you have to send the following message: "{\"command\":\"subscribe\",\"channel\":1002}". Again be careful to use the correct quotes.
Hope this helps.

Intercept and modify Ack response message BizTalk 2013 R2

I have written a custom pipeline component assembler to modify the response ACK HL7 message.
I have invoked Assemble(pContext) of Microsoft.Solutions.BTAHL7.Pipelines.HL72fAsm in the implemented method Assemble(pContext) of IAssemblerComponent interface
gives me result IBaseMessage
which is an HL7, then I do my manipulations on it to fix one of the fields and return that modified IBaseMessage.
All these works just fine, I tried EvenLogger to verify it.
But still the Sender application doesn't receive the modified message, it receives the auto-generated message.
Is there something I'm missing out, why do I not get the custom assembler result out from the SendPipeline of 2 way receive port
Note : BTAHL7 Configuration explorer is configured for original mode. The send pipeline on RequestResponse receive port is set to my custom pipeline
My suggestion is after all the more important points.
The first thing you're employer or customer should say is NO. That is invalid HL7 and you cannot support that.
But, if they are unable to unwilling to comply, the next thing you need to do is inform your management that their non-compliance will cost you a lot of extra time and money to accommodate. To fully support this change will likely cost more then implementing the business messages, I am totally serious. This is not a problem with BizTalk Server, you app or you.
Depending on the relationship, your management can legitimately ask them how they are going to pay for this customization. It's going to cost your side a lot more to break HL7 to comply with them than it will for them to fix it.
Next, and perhaps most important, due to the nature of it's message content, HL7 has very strict completeness requirements, which they are fundamentally breaking. The Trading Partner needs to fully document this requirement to take ownership of it because there is a huge consequence, they are breaking tracing/tracking on you end.
This means that it will be substantially more difficult to investigate and resolve messaging issues for you, not them. This might raise legal or compliance issues your side needs to be aware of.
So, provided you technical, medical and legal teams are all satisfied, the first thing I would try is a Pipeline Component that simply swaps the two values, MSH10 and MSA02. That way, they will receive both values.
Finally, here's a novel solution. Since this is their problem, and a problem for every one of their trading partners, what if you offer help them fix it. All then need to do is what I suggested, swap MSH10 and MSA02 on the received message.

Search contract and web services

I'm trying to come to grips with the search contract for Modern UI applications. In my particular case the items to search for come from a web based service so I'm hesitant to pull them all over the web and then let the user search the results for potentially a single match. My question is, how shall I go about that? Preferably, I'd just hook into the QuerySubmitted event and hit the web service from there, using the String from e.QueryText. Is that considered good practice?
If all you want is a simple server side search, then yes, hooking the QuerySubmitted event and passing the query text to your service is fine. This assumes, of course, that your service supports that kind of lookup (i.e., it has a GetProductsByText rather than just a GetAllProducts).
Things get trickier if you want to use autocomplete and provide recommendations/suggestions to the user while they are typing by handing the SuggestionsRequested event. In that case, start by looking at the Search Contract Sample for an example of how to handle that (in addition to being a good resource for understanding how tow work with the Search contract in general).
You can even have a loot at https://www.simple-talk.com/content/print.aspx?article=1716 to have a better picture..!

Removing previous part from Reply emails

I'm trying to write application that periodically receives e-mails. It writes every mail into database. But sometimes i'm getting 'Re:' e-mail that looks something like this:
New message
On September 21, 2010 24:26 Someone wrote (a):
| Old message
|
The format depends on e-mail provider.
Is there any library that helps removing 'Re' part from e-mail message? Maybe IMAP server can do that? I have all the previous e-mails from thread in database so I can take them and search in new message.
If you are able to associate a reply (RE:) message with the original/previous message that it is a reply to, then I would think that you could grab the body text of the original/previous message from your database, and then remove that text from the body of the reply. However, this method will not be 100% accurate, because clients could convert an HTML/Rich Text email in to plain text, or vice-versa. In any such case, this method probably wouldn't work. Even so, this technique would be generic and probably work the majority of the time.
In addition, the email provider may add certain header fields, or preambles, to the beginnings of a quoted message in a reply. In this case, I don't think there is any "catch all" solution.
My recommendation would be to target a few of the really huge web-mail providers (Gmail, Yahoo, Microsoft, etc), learn the formats that they use for their replies and parse the messages accordingly. In addition, you could likely handle a few generic formats as well. For instance, the '>' character is commonly used at the beginning of each line of quoted text in a reply.
If you're going to be developing in a language like C#, create yourself an Interface like IReplyFormat, with a corresponding implementation for each provider, and possibly some generic formats.
I don't think you will find any catch-all/perfect solution to this problem, as there are simply too many mail providers with too many different formats. However, I think you can at the very least find some techniques, like the ones mentioned above, that will work for you more times than not, which is the best you can hope for at this point.
Personally I think that you are out of luck here, as the message copy is part of the body. So in order to remove it you will have to process the message's body and write an extraction method for each known format (obviously the problem is that you cannot know all possible formats).
So, instead of parsing the body why don't you persist the whole message into the database? Normally the size of the message should not be the problem with modern DBMS. If it really is a problem you always can compress the body and store it in a BLOB.
No IMAP Server will not and does not remove anything
Such library does not exist because there is no standard, every email provider does it differently, gmail etc have developped their own tools
You have to look for pattern, that will somehow begin with headers with recipient as sender, like...
From: <receipent>
From: "NAME" <receipent>
From: receipent
and you have to omit the parts from this line below, howerver only checking this will not be sufficient as usually from is followed by subject,cc,to etc, so the pattern needs to be checked. I think some open source project or text library may exist, but its too difficult to find it on google.
I agree with Obalix. It's too hard to filter out replies so must keep the whole message. However, when you present email to the user, you can hide some parts of it. Those part can be shown with an optional "Click here to see the full message" or similar. For instance, regular expression to filter '>' characters would look something like #"^[ \f\t\v>]*"

Categories