Error when sending message to Bloomberg via QuickFixJ - bloomberg

I'm trying to sending packet type X to Bloomberg via QuickFixJ. I'm able to connect successfully but when I send the packet, I receive an error message :
8=FIXT.1.1^A9=160^A35=X^A34=4^A49=ARHGBETA^A52=20210915-13:16:04.156^A56=BBGBETA^A1022=****^A22=1^A48=BQ4434677^A268=2^A279=0^A269=0^A270=99.00357818603516^A279=0^A269=1^A270=99.01358032226562^A10=060^A
8=FIXT.1.1^A9=253^A35=j^A49=BBGBETA^A56=ARHGBETA^A34=4^A52=20210915-13:16:04.380^A45=4^A372=X^A380=0^A58=Validation failed for incoming X packet:
In mDIncGrp: In groupMDEntries[0]: NULL component instrument_MarketData
In groupMDEntries[1]: NULL component instrument_MarketData
And yet, I don't see how to define the component instrument_MarketData. I'm using the following code to generate the groups:
/**
* Méthode de création d'un nouveau prix pour le publier sur Bloomberg
* #param marketPrice
* */
public MarketDataIncrementalRefresh createMarketDataIncrementalRefresh(MarketPrice marketPrice) {
quickfix.fix50sp2.MarketDataIncrementalRefresh message = new MarketDataIncrementalRefresh();
quickfix.fix50sp2.MarketDataIncrementalRefresh.NoMDEntries group = new MarketDataIncrementalRefresh.NoMDEntries();
message.getHeader().setString(1022, "****");
quickfix.fix50sp2.component.MDIncGrp mdIncGrp = new MDIncGrp();
mdIncGrp.setString(48, marketPrice.getCUSIP());
mdIncGrp.setString(22, "1");
Instrument instrument =new Instrument();
/**
* Ajout prix Bid au message
* */
instrument.setString(279, "0");
instrument.setString(269, "0");
instrument.setString(270, marketPrice.getBid_kech().toString());
group.set(instrument);
mdIncGrp.addGroup(group);
/**
* Ajout prix Ask au message
* */
instrument.setString(279, "0");
instrument.setString(269, "1");
instrument.setString(270, marketPrice.getAsk_kech().toString());
group.set(instrument);
mdIncGrp.addGroup(group);
message.set(mdIncGrp);
return message;
}
What am I doing wrong? Should I define a custom dictionary to be able to send the message or can I do it with the default dictionary?
Many thanks in advance !

You do not need a custom dictionary to send custom messages. Dictionary validation is only done for received messages, so you might need to alter your dictionary to successfully receive the responses sent by your counterparty.
As to your problem: the error sounds as if something is missing in your group regarding the instrument. Looking at your code I think you mix up the group stuff a bit. I posted this link for an earlier question of you: https://www.quickfixj.org/usermanual/2.3.0/usage/repeating_groups.html
I think the important part is that you should add the group to the message like so:
quickfix.fix42.MarketDataSnapshotFullRefresh.NoMDEntries group =
new quickfix.fix42.MarketDataSnapshotFullRefresh.NoMDEntries();
group.set(new MDEntryType('0'));
group.set(new MDEntryPx(12.32));
group.set(new MDEntrySize(100));
group.set(new OrderID("ORDERID"));
message.addGroup(group); // important part
In your code you are adding a group to a group (mdIncGrp.addGroup(group)) and do a message.set(mdIncGrp) where you really should use addGroup(). Because of this the 48/SecurityID field does not end up in the MDIncGrp but the root message.
8=FIXT.1.1^....removed...^A22=1^A48=BQ4434677^A268=2^A279=0^A269=0^A270=99.00357818603516^A279=0^A269=1^A270=99.01358032226562^A10=060^A
^^^ 48 is here where it should really
be in each of these groups starting with delimiter tag 279

Related

what is correct use of consumer groups in spring cloud stream dataflow and rabbitmq?

A follow up to this:
one SCDF source, 2 processors but only 1 processes each item
The 2 processors (del-1 and del-2) in the picture are receiving the same data within milliseconds of each other. I'm trying to rig this so del-2 never receives the same thing as del-1 and vice versa. So obviously I've got something configured incorrectly but I'm not sure where.
My processor has the following application.properties
spring.application.name=${vcap.application.name:sample-processor}
info.app.name=#project.artifactId#
info.app.description=#project.description#
info.app.version=#project.version#
management.endpoints.web.exposure.include=health,info,bindings
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
spring.cloud.stream.bindings.input.group=input
Is "spring.cloud.stream.bindings.input.group" specified correctly?
Here's the processor code:
#Transformer(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT)
public Object transform(String inputStr) throws InterruptedException{
ApplicationLog log = new ApplicationLog(this, "timerMessageSource");
String message = " I AM [" + inputStr + "] AND I HAVE BEEN PROCESSED!!!!!!!";
log.info("SampleProcessor.transform() incoming inputStr="+inputStr);
return message;
}
Is the #Transformer annotation the proper way to link this bit of code with "spring.cloud.stream.bindings.input.group" from application.properties? Are there any other annotations necessary?
Here's my source:
private String format = "EEEEE dd MMMMM yyyy HH:mm:ss.SSSZ";
#Bean
#InboundChannelAdapter(value = Source.OUTPUT, poller = #Poller(fixedDelay = "1000", maxMessagesPerPoll = "1"))
public MessageSource<String> timerMessageSource() {
ApplicationLog log = new ApplicationLog(this, "timerMessageSource");
String message = new SimpleDateFormat(format).format(new Date());
log.info("SampleSource.timeMessageSource() message=["+message+"]");
return () -> new GenericMessage<>(new SimpleDateFormat(format).format(new Date()));
}
I'm confused about the "value = Source.OUTPUT". Does this mean my processor needs to be named differently?
Is the inclusion of #Poller causing me a problem somehow?
This is how I define the 2 processor streams (del-1 and del-2) in SCDF shell:
stream create del-1 --definition ":split > processor-that-does-everything-sleeps5 --spring.cloud.stream.bindings.applicationMetrics.destination=metrics > :merge"
stream create del-2 --definition ":split > processor-that-does-everything-sleeps5 --spring.cloud.stream.bindings.applicationMetrics.destination=metrics > :merge"
Do I need to do anything differently there?
All of this is running in Docker/K8s.
RabbitMQ is given by bitnami/rabbitmq:3.7.2-r1 and is configured with the following props:
RABBITMQ_USERNAME: user
RABBITMQ_PASSWORD <redacted>:
RABBITMQ_ERL_COOKIE <redacted>:
RABBITMQ_NODE_PORT_NUMBER: 5672
RABBITMQ_NODE_TYPE: stats
RABBITMQ_NODE_NAME: rabbit#localhost
RABBITMQ_CLUSTER_NODE_NAME:
RABBITMQ_DEFAULT_VHOST: /
RABBITMQ_MANAGER_PORT_NUMBER: 15672
RABBITMQ_DISK_FREE_LIMIT: "6GiB"
Are any other environment variables necessary?

Paypal Php Sdk - NotifyUrl is not a fully qualified URL Error

I have this code
$product_info = array();
if(isset($cms['site']['url_data']['product_id'])){
$product_info = $cms['class']['product']->get($cms['site']['url_data']['product_id']);
}
if(!isset($product_info['id'])){
/*
echo 'No product info.';
exit();
*/
header_url(SITE_URL.'?subpage=user_subscription#xl_xr_page_my%20account');
}
$fee = $product_info['yearly_price_end'] / 100 * $product_info['fee'];
$yearly_price_end = $product_info['yearly_price_end'] + $fee;
$fee = ($product_info['setup_price_end'] / 100) * $product_info['fee'];
$setup_price_end = $product_info['setup_price_end'] + $fee;
if(isset($_SESSION['discountcode_amount'])){
$setup_price_end = $setup_price_end - $_SESSION['discountcode_amount'];
unset($_SESSION['discountcode_amount']);
}
$error = false;
$plan_id = '';
$approvalUrl = '';
$ReturnUrl = SITE_URL.'payment/?payment_type=paypal&payment_page=process_agreement';
$CancelUrl = SITE_URL.'payment/?payment_type=paypal&payment_page=cancel_agreement';
$now = $cms['date'];
$now->modify('+5 minutes');
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
$cms['options']['plugin_paypal_clientid'], // ClientID
$cms['options']['plugin_paypal_clientsecret'] // ClientSecret
)
);
use PayPal\Api\ChargeModel;
use PayPal\Api\Currency;
use PayPal\Api\MerchantPreferences;
use PayPal\Api\PaymentDefinition;
use PayPal\Api\Plan;
use PayPal\Api\Patch;
use PayPal\Api\PatchRequest;
use PayPal\Common\PayPalModel;
use PayPal\Api\Agreement;
use PayPal\Api\Payer;
use PayPal\Api\ShippingAddress;
// Create a new instance of Plan object
$plan = new Plan();
// # Basic Information
// Fill up the basic information that is required for the plan
$plan->setName($product_info['name'])
->setDescription($product_info['desc_text'])
->setType('fixed');
// # Payment definitions for this billing plan.
$paymentDefinition = new PaymentDefinition();
// The possible values for such setters are mentioned in the setter method documentation.
// Just open the class file. e.g. lib/PayPal/Api/PaymentDefinition.php and look for setFrequency method.
// You should be able to see the acceptable values in the comments.
$setFrequency = 'Year';
//$setFrequency = 'Day';
$paymentDefinition->setName('Regular Payments')
->setType('REGULAR')
->setFrequency($setFrequency)
->setFrequencyInterval("1")
->setCycles("999")
->setAmount(new Currency(array('value' => $yearly_price_end, 'currency' => $cms['session']['client']['currency']['iso_code'])));
// Charge Models
$chargeModel = new ChargeModel();
$chargeModel->setType('SHIPPING')
->setAmount(new Currency(array('value' => 0, 'currency' => $cms['session']['client']['currency']['iso_code'])));
$paymentDefinition->setChargeModels(array($chargeModel));
$merchantPreferences = new MerchantPreferences();
// ReturnURL and CancelURL are not required and used when creating billing agreement with payment_method as "credit_card".
// However, it is generally a good idea to set these values, in case you plan to create billing agreements which accepts "paypal" as payment_method.
// This will keep your plan compatible with both the possible scenarios on how it is being used in agreement.
$merchantPreferences->setReturnUrl($ReturnUrl)
->setCancelUrl($CancelUrl)
->setAutoBillAmount("yes")
->setInitialFailAmountAction("CONTINUE")
->setMaxFailAttempts("0")
->setSetupFee(new Currency(array('value' => $setup_price_end, 'currency' => $cms['session']['client']['currency']['iso_code'])));
$plan->setPaymentDefinitions(array($paymentDefinition));
$plan->setMerchantPreferences($merchantPreferences);
// ### Create Plan
try {
$output = $plan->create($apiContext);
} catch (Exception $ex){
die($ex);
}
echo $output->getId().'<br />';
echo $output.'<br />';
Been working with paypal php sdk for some days now and my code stop working.
So i went back to basic and i am still getting the same damn error.
I am trying to create a plan for subscription but getting the following error:
"NotifyUrl is not a fully qualified URL"
I have no idea how to fix this as i dont use NotfifyUrl in my code?
Could be really nice if anyone had an idea how to fix this problem :)
Thanks
PayPal did a update to their API last night which has caused problem within their SDK.
They are sending back null values in their responses.
I MUST stress the error is not on sending the request to PayPal, but on processing their response.
BUG Report : https://github.com/paypal/PayPal-PHP-SDK/issues/1151
Pull Request : https://github.com/paypal/PayPal-PHP-SDK/pull/1152
Hope this helps, but their current SDK is throwing exceptions.
Use below simple fix.
Replace below function in vendor\paypal\rest-api-sdk-php\lib\PayPal\Api\MerchantPreferences.php
public function setNotifyUrl($notify_url)
{
if(!empty($notify_url)){
UrlValidator::validate($notify_url, "NotifyUrl");
}
$this->notify_url = $notify_url;
return $this;
}
If you get the same error for return_url/cancel_url, add the if condition as above.
Note: This is not a permanent solution, you can use this until getting the update from PayPal.
From the GitHub repo for the PayPal PHP SDK, I see that the error you mentioned is thrown when MerchantPreferences is not given a valid NotifyUrl. I see you're setting the CancelUrl and ReturnUrl, but not the NotifyUrl. You may simply need to set that as well, i.e.:
$NotifyUrl = (some url goes here)
$obj->setNotifyUrl($NotifyUrl);
Reason behind it!
error comes from.
vendor\paypal\rest-api-sdk-php\lib\PayPal\Validation\UrlValidator.php
line.
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
throw new \InvalidArgumentException("$urlName is not a fully qualified URL");
}
FILTER_VALIDATE_URL: according to this php function.
INVALID URL: "http://cat_n.domain.net.in/"; // IT CONTAIN _ UNDERSCORE.
VALID URL: "http://cat-n.domain.net.in/"; it separated with - dash
here you can dump your url.
vendor\paypal\rest-api-sdk-php\lib\PayPal\Validation\UrlValidator.php
public static function validate($url, $urlName = null)
{
var_dump($url);
}
And then check this here: https://www.w3schools.com/PHP/phptryit.asp?filename=tryphp_func_validate_url
you can check here what character will reason for invalid.

How to get delivery report from SMSC using Jamaa-Smpp and C#?

How to get delivery report from SMSC using Jamaa-Smpp and C#?
Thanks in advance,
We can get delivery report in Jamaa-Smpp by using client_MessageDelivered event
First ,we need to use this code:
SmppClient(); client = new SmppClient();
client.MessageDelivered += new EventHandler<MessageEventArgs>(client_MessageDelivered);
Second , we need to use this code:
void client_MessageDelivered(object sender, MessageEventArgs e)
{
TextMessage msg = e.ShortMessage as TextMessage;
string msgtext=msg.text;
}
and do not forget to set value to SubmitSm.RegisteredDelivery as your work requirements:
//SMSC delivery receipt requested where final delivery outcome is deliver success or failure
SubmitSm.RegisteredDelivery = RegisteredDelivery.DeliveryReceipt;
or
//SMSC delivery receipt requested where the final delivery outcome is delivery failure
SubmitSm.RegisteredDelivery = RegisteredDelivery.DeliveryReceiptFailure;

Lotus/Domino User creation flag fREGExtMailReplicasUsingAdminp: How to specify replication details

I need to program a client to Domino Server using Notes C API which registers a new Lotus Notes user. Using REGNewUser (see http://www-12.lotus.com/ldd/doc/domino_notes/8.5.3/api853ref.nsf/ef2467c10609eaa8852561cc0067a76f/0326bfa2438ebe9985256678006a6ff2?OpenDocument&Highlight=0,REGNew*) and it looks promising except for the fact that I need to make the user's mail file replicate from the specified mail server to the mail server's cluster partner. There is the flag
fREGExtMailReplicasUsingAdminp
and the documentation is very brief about it:
"Create mail replicas via the administration process"
If I google the flag I get 4 (!) hits.
How do I specify where the mail file replica is created? Does anyone have any more information about what this flag is actually doing?
Thanks
Kai
After 3 weeks of research in the Notes C API reference I found:
In REGNewPerson there are 2 structures REG_MAIL_INFO_EXT and REG_PERSON_INFO and if you set the above mentioned flag in REG_PERSON_INFO then you have to provide a list of replica servers in REG_MAIL_INFO_EXT like this:
REG_MAIL_INFO_EXT mail_info, *pmail_info;
REG_PERSON_INFO person_info, *pperson_info;
...
pmail_info = &mail_info;
pperson_info = &person_info;
...
// pmail_info->pMailForwardAddress = NULL; // brauchen wir nicht.
pmail_info->pMailServerName = mailserver;
pmail_info->pMailTemplateName = mailfiletemplate;
// do the list crap for replica servers
if (error = ListAllocate (0, 0, FALSE, &hReplicaServers, &pList, &list_size)) {
goto __error;
}
OSUnlock (hReplicaServers);
pList = NULL;
if (error = ListAddEntry (hReplicaServers, // handle to list
FALSE, // do not include data type
&list_size, // pass list size in memory
0, // index to add
replicationserver, // value to add
(WORD) strlen(replicationserver))) // size of value to add
{
goto __error;
}
// now we can add the handle to the structure
pmail_info->hReplicaServers = hReplicaServers;
...
pperson_info->MailInfo = pmail_info;
...
pperson_info->Flags = fREGCreateIDFileNow | fREGCreateAddrBookEntry | fREGCreateMailFileUsingAdminp;
pperson_info->FlagsExt = fREGExtEnforceUniqueShortName | fREGExtMailReplicasUsingAdminp;
In my case this did the trick.

How to set extended properties of the forwarded message using EWS API?

I'm using EWS api and I whant to forward email message with addition internet headers.
This is how I forward email message:
// emilMsg is of type EmailMessage
ResponseMessage forwardMsg = emailMsg.createForward();
forwardMsg.send();
The main problem that "createForward" returns object of type ResponseMessage. I know how to add extended properties in EmailMessage, but what about ResponseMessage?
What you can do is, first save ResponseMessage that would give you an EmailMessage, then set extendedProperties in that :-)
Something like this ::
emailMessage = responseMessage.save();
UUID yourPropertySetId = UUID.fromString("01638372-9F96-43b2-A403-B504ED14A910");
ExtendedPropertyDefinition propertyDefinitionBase = new ExtendedPropertyDefinition( yourPropertySetId,
"MyProperty",
MapiPropertyType.String);
emailMessage.setExtendedProperty( propertyDefinitionBase, "MyValue" );
emailMessage.send();